/* ═══════════════════════════════════════════════════
   관리자 편집 모드 스타일
   ═══════════════════════════════════════════════════ */

/* 편집 배너 높이 변수 */
:root { --admin-banner-h: 44px; }

/* 전체 사이트 파란 테두리 */
.admin-edit-mode {
    outline: 4px solid #2563eb !important;
    outline-offset: -4px;
}

/* ── 배너/nav 겹침 해결 ──────────────────────────── */
/* 편집 배너(fixed top:0)가 있을 때 nav를 그 아래로 밀기 */
body.admin-edit-mode nav {
    top: var(--admin-banner-h) !important;
}
/* body 위쪽 여백: 배너 높이만큼 추가 */
body.admin-edit-mode {
    padding-top: var(--admin-banner-h);
}

/* 편집 가능 이미지 하이라이트 */
.admin-edit-mode [data-edit-type="image"] {
    outline: 2px dashed #2563eb;
    cursor: pointer;
    transition: outline 0.2s;
}
.admin-edit-mode [data-edit-type="image"]:hover {
    outline: 3px solid #2563eb;
}

/* 이미지 래퍼 - 버튼 위치 기준 */
.edit-img-wrap {
    position: relative;
}

/* 이미지 변경 오버레이 버튼
   position:fixed → 오버레이/스태킹컨텍스트에 상관없이 항상 클릭 가능 */
.edit-img-btn {
    position: fixed;
    /* top / left 은 JS 에서 이미지 중심좌표로 설정 */
    transform: translate(-50%, -50%);
    background: rgba(37, 99, 235, 0.92);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 200;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    transition: background 0.2s, transform 0.15s;
    pointer-events: all;
}
.edit-img-btn:hover {
    background: #1d4ed8;
    transform: translate(-50%, -50%) scale(1.05);
}
.edit-img-btn .material-symbols-outlined {
    font-size: 18px;
}

/* 텍스트 편집 활성 상태 */
.admin-text-editable {
    outline: 2px dashed #2563eb !important;
    border-radius: 4px;
    padding: 2px 6px !important;
    cursor: text;
    min-width: 20px;
    min-height: 1em;
    transition: outline 0.15s, background 0.15s;
    white-space: pre-wrap;
}
.admin-text-editable:focus,
.admin-text-editable:focus-visible {
    outline: 2px solid #2563eb !important;
    background: rgba(219, 234, 254, 0.25) !important;
}

/* ── 상단 편집 배너 ──────────────────────────────── */
#admin-edit-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 12px rgba(37,99,235,0.35);
}
#admin-edit-banner .material-symbols-outlined {
    font-size: 20px;
}

/* ── 배너 내 버튼들 ───────────────────────────── */
.admin-banner-btn-primary {
    background: #fff;
    color: #2563eb;
    border: none;
    border-radius: 7px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.admin-banner-btn-primary:hover { background: #dbeafe; }

.admin-banner-btn-secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 7px;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
}
.admin-banner-btn-secondary:hover { background: rgba(255,255,255,0.25); }
.admin-banner-btn-secondary .material-symbols-outlined { font-size: 18px; }

/* ── 팝업 관리 대형 모달 ─────────────────────────────── */
#popup-mgr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
.admin-modal-large {
    background: #fff;
    border-radius: 24px;
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0,0,0,0.3);
}
.mgr-header {
    padding: 20px 28px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mgr-header h3 { margin: 0; font-size: 18px; font-weight: 800; color: #1e293b; }
.mgr-close { 
    background: none; border: none; font-size: 28px; cursor: pointer; color: #94a3b8; 
    transition: color 0.2s;
}
.mgr-close:hover { color: #475569; }

.mgr-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.popup-list { margin-bottom: 24px; max-height: 200px; overflow-y: auto; border: 1px solid #f1f5f9; border-radius: 12px; }
.mgr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mgr-table th { text-align: left; background: #f8fafc; padding: 10px 14px; color: #64748b; font-weight: 600; position: sticky; top: 0; }
.mgr-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }

.btn-toggle {
    padding: 4px 10px; border-radius: 6px; border: 1px solid #e2e8f0; background: #f8fafc;
    font-size: 11px; font-weight: 700; color: #94a3b8; cursor: pointer;
}
.btn-toggle.active { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

.btn-edit, .btn-del {
    padding: 4px 10px; border-radius: 6px; border: none; font-size: 11px; font-weight: 700; cursor: pointer; margin-right: 4px;
}
.btn-edit { background: #eff6ff; color: #2563eb; }
.btn-del { background: #fef2f2; color: #ef4444; }

.empty-msg { text-align: center; color: #94a3b8; padding: 30px; font-size: 14px; }

.mgr-divider { border: none; border-top: 1px solid #e2e8f0; margin: 24px 0; }

.popup-form h4 { margin: 0 0 16px; font-size: 15px; font-weight: 800; color: #334155; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 12px; font-weight: 700; color: #64748b; }
.form-row input[type="text"], .form-row input[type="number"], .form-row input[type="file"] {
    width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 12px; outline: none; transition: border-color 0.2s; font-size: 14px;
    box-sizing: border-box;
}
.form-row input:focus { border-color: #2563eb; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }

.form-btns { display: flex; gap: 10px; margin-top: 20px; }
.form-btns button { flex: 1; padding: 12px; border-radius: 9px; font-size: 14px; font-weight: 800; cursor: pointer; border: none; }
.btn-reset { background: #f1f5f9; color: #64748b; }
.btn-save { background: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }

/* ── 비밀번호 모달 ───────────────────────────────── */
#admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
#admin-modal {
    background: #fff;
    border-radius: 18px;
    padding: 36px 32px 28px;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 30px 70px rgba(0,0,0,0.25);
}
#admin-modal h3 {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px;
}
#admin-modal p.subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 20px;
}
#admin-pw-input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 9px;
    padding: 13px 16px;
    font-size: 16px;
    outline: none;
    margin-bottom: 14px;
    box-sizing: border-box;
    transition: border-color 0.15s;
    letter-spacing: 0.15em;
}
#admin-pw-input:focus { border-color: #2563eb; }
.admin-modal-btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.admin-modal-btns button {
    padding: 11px 22px;
    border-radius: 9px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.admin-modal-btns .btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}
.admin-modal-btns .btn-cancel:hover { background: #e2e8f0; }
.admin-modal-btns .btn-submit {
    background: #2563eb;
    color: #fff;
}
.admin-modal-btns .btn-submit:hover { background: #1d4ed8; }
#admin-pw-error {
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    min-height: 18px;
}

/* ── 토스트 알림 ─────────────────────────────────── */
.admin-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999999;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    max-width: 320px;
}
.admin-toast.show {
    transform: translateY(0);
    opacity: 1;
}
.admin-toast-success { background: #16a34a; }
.admin-toast-error   { background: #dc2626; }
.admin-toast-info    { background: #2563eb; }

/* ── 관리 버튼 (푸터) ───────────────────────────── */
#footer-admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(88,100,0,0.3);
    color: #5b632b;
    border-radius: 6px;
    padding: 5px 13px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.05em;
}
#footer-admin-btn:hover {
    background: #586400;
    color: #fff;
    border-color: #586400;
}
#footer-admin-btn .material-symbols-outlined {
    font-size: 15px;
}
