/* ============================================================
 * admin.css — 어드민 공통 스타일
 * Design Ref: §2.1 — Option B 완전 분리 / 어드민 영역 파랑 팔레트
 * 적용 대상: login.php, manage.php
 * ============================================================ */

@font-face {
    font-family: "NanumBarunGothic";
    src: url("../assets/NanumBarunGothic.ttf") format("truetype");
    font-weight: lighter;
}

/* ── 토큰 ── */
:root {
    --bg:         #f2f4f7;
    --card:       #ffffff;
    --radius:     12px;
    --shadow:     0 1px 4px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.06);
    --accent:     #2d6cdf;
    --accent-dk:  #2259bf;
    --accent-ring: rgba(45,108,223,.15);
    --ibtn:       #627eca;
    --text:       #1c2130;
    --muted:      #6b7280;
    --border:     #d4d8e0;
    --trans:      160ms ease;
}

/* ── 리셋 ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    font-family: "NanumBarunGothic", -apple-system, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── 레이아웃 ── */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px;
}

.container--narrow {
    max-width: 460px;
    padding: 32px 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.top-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

/* ── 카드 ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 18px;
    margin-top: 16px;
}

/* ── 타이포 ── */
h1 { font-size: 19px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.3px; }
h2 { font-size: 15px; font-weight: 800; margin: 0 0 18px; color: #374151; letter-spacing: -.1px; }

/* ── 폼 ── */
label {
    display: block;
    margin: 16px 0 5px;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 15px;
    font-family: "NanumBarunGothic", -apple-system, sans-serif;
    background: #fff;
    color: var(--text);
    transition: border-color var(--trans), box-shadow var(--trans);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input:hover, textarea:hover, select:hover { border-color: #b0b8c8; }

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

textarea {
    min-height: 90px;
    resize: none;
    line-height: 1.55;
    overflow-y: hidden;
    height: auto;
}

.time-flex { display: flex; align-items: center; gap: 6px; }
.time-flex select { flex: 1 1 0; }
.time-sep { font-size: 15px; font-weight: 700; color: #888; }

/* ── 버튼 ── */
button {
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(170deg, #4a84f0, var(--accent-dk));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: "NanumBarunGothic", -apple-system, sans-serif;
    box-shadow: 0 2px 8px rgba(45,108,223,.22);
    transition: box-shadow var(--trans), filter var(--trans), transform var(--trans);
    letter-spacing: -.1px;
}

button:hover  { filter: brightness(1.07); box-shadow: 0 4px 14px rgba(45,108,223,.3); }
button:active { filter: brightness(.96); transform: translateY(1px); box-shadow: 0 1px 4px rgba(45,108,223,.15); }

.btn-full {
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    font-size: 15px;
}

button.logout {
    background: #f1f3f7;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
button.logout:hover { background: #e8eaf0; box-shadow: 0 2px 6px rgba(0,0,0,.1); filter: none; }

button.link {
    width: 100%;
    background: #eeedf9;
    color: #3730a3;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
button.link:hover { background: #e5e3f5; filter: none; }

.preview-ghost {
    background: #f1f3f7;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.preview-ghost:hover { background: #e8eaf0; filter: none; }

.more-btn {
    width: 38px; height: 38px;
    padding: 0;
    border-radius: 9px;
    background: #f1f3f7;
    color: #374151;
    display: grid;
    place-items: center;
    box-shadow: none;
}
.more-btn:hover { background: #e8eaf0; filter: none; }
.more-btn svg { display: block; fill: currentColor; }

.crop-mini-btn {
    min-width: 42px; height: 38px;
    padding: 0 12px;
    background: #f1f3f7;
    color: #374151;
    font-weight: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.crop-mini-btn:hover { background: #e8eaf0; filter: none; }

@media (max-width: 480px) {
    .crop-mini-btn { min-width: 38px; height: 36px; padding: 0 10px; font-size: 14px; }
    #logo-crop-size-info { font-size: 12px !important; }
}

.manual-btn {
    height: 36px;
    padding: 0 13px;
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    border: 1.5px solid var(--border);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    transition: border-color var(--trans), color var(--trans);
}
.manual-btn:hover { border-color: #b0b8c8; color: var(--text); }

/* ── 피드백 ── */
.err {
    background: #fff5f5;
    border: 1.5px solid #fbd5d5;
    color: #7a1f1f;
    padding: 10px 14px;
    border-radius: 9px;
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.55;
}

.helper {
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.6;
}

/* ── 뱃지 ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 700;
}

.badge-new {
    position: absolute;
    left: 6px; top: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 700;
}

/* ── 갤러리 ── */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}
@media (min-width: 400px) { .gallery { grid-template-columns: repeat(3, 1fr); } }

.item {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 1px;
    display: block;
    transition: border-color var(--trans);
}
.item:hover { border-color: #b0b8c8; }

.thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    cursor: grab;
}

.img-card { touch-action: none; user-select: none; }
.img-card.dragging { opacity: .75; transform: scale(.97); box-shadow: 0 8px 24px rgba(0,0,0,.14); }

/* ── 저장 바 ── */
.savebar {
    position: sticky;
    bottom: 0;
    background: rgba(255,255,255,.90);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    padding: 10px 18px;
    border-top: 1px solid rgba(0,0,0,.06);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    z-index: 999;
    margin-top: 16px;
}

/* ── xbtn ── */
.xbtn {
    position: absolute;
    top: -2px; right: -2px;
    z-index: 2;
    width: 34px; height: 34px;
    padding: 0; margin: 0; border: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    place-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.xbtn__circle {
    width: 20px; height: 20px;
    border-radius: 999px;
    background: rgba(0,0,0,.52);
    display: grid;
    place-items: center;
    color: #fff;
    transition: background var(--trans), transform var(--trans);
}
.xbtn__icon line { stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.xbtn:hover .xbtn__circle  { background: rgba(210,30,30,.85); }
.xbtn:active .xbtn__circle { transform: scale(.88); }
.xbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 이벤트/로고 이미지 ── */
.event-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.event-frame { position: relative; display: inline-block; width: 100%; }

.event-thumb {
    width: 100%;
    object-fit: cover;
    border-radius: 9px;
    border: 1.5px solid var(--border);
    display: block;
}

.event-xbtn {
    position: absolute;
    top: -2px; right: -2px;
    z-index: 2;
    width: 34px; height: 34px;
    padding: 0; margin: 0; border: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    place-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* ── 파일 업로드 ── */
input[type="file"] {
    appearance: none;
    -webkit-appearance: none;
    border: none !important;
    box-shadow: none !important;
    background: transparent;
    padding: 4px;
    width: auto;
    cursor: default;
    font-size: 0;
}
input[type="file"]:hover, input[type="file"]:focus { border: none; box-shadow: none; }

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 7px 13px;
    border-radius: 7px;
    background: linear-gradient(170deg, #7a95d8, var(--ibtn));
    color: #fff;
    border: none;
    box-shadow: 0 2px 6px rgba(98,126,202,.25);
    transition: filter var(--trans);
    font-family: "NanumBarunGothic", sans-serif;
}
input[type="file"]::file-selector-button:hover { filter: brightness(1.07); }

/* ── 미리보기 패널 ── */
#preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px 8px;
}
#preview-close { background: #f1f3f7; color: #374151; }
#preview-frame { width: 100%; height: 80vh; border: 0; display: block; border-radius: 8px; overflow: hidden; }
@media (min-width: 720px) { #preview-frame { height: 84vh; } }

/* ── 더보기 메뉴 ── */
.more-wrap { position: relative; flex: 0 0 auto; }

.more-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,.04), 0 10px 24px rgba(0,0,0,.09);
    padding: 5px;
    z-index: 1200;
}

.more-menu-item {
    width: 100%; display: block; text-align: left;
    padding: 9px 11px;
    border: 0; border-radius: 7px;
    background: transparent;
    color: #374151;
    font-size: 14px; font-weight: 600;
    font-family: "NanumBarunGothic", -apple-system, sans-serif;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition: background var(--trans);
}
.more-menu-item:hover   { background: #f4f6f9; }
.more-menu-item:active  { transform: none; }
.logout-item { color: #b42318; }

/* ── 동영상 라디오 ── */
.video-mode-box { margin-top: 8px; }
#div_video_link, #div_video_upload { margin-top: 8px; }
#video-preview { max-height: 420px; object-fit: contain; }
@media (max-width: 480px) { #video-preview { max-height: 280px; } }

.video-radio-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 12px;
}
@media (max-width: 560px) {
    .video-radio-group { grid-template-columns: 1fr; }
    .video-radio-ui { min-height: 58px; padding: 12px 14px; }
}

.video-radio-card { display: block; margin: 0; cursor: pointer; font-weight: 400; }

.video-radio-card input[type="radio"] {
    position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}

.video-radio-ui {
    display: flex; align-items: center; gap: 12px;
    min-height: 66px; padding: 13px 15px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fafbfc;
    transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
}
.video-radio-card:hover .video-radio-ui { border-color: #b0b8c8; background: #f7f9fc; }

.video-radio-dot {
    width: 18px; height: 18px;
    border: 2px solid #c0c8d4;
    border-radius: 999px;
    background: #fff;
    position: relative;
    flex: 0 0 18px;
    transition: border-color var(--trans);
}
.video-radio-dot::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 9px; height: 9px;
    border-radius: 999px;
    background: var(--accent);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 160ms cubic-bezier(.34,1.56,.64,1);
}
.video-radio-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.video-radio-text strong { font-size: 14px; font-weight: 700; color: var(--text); }
.video-radio-text small  { font-size: 12px; color: var(--muted); font-weight: 500; }

.video-radio-card input[type="radio"]:checked + .video-radio-ui {
    border-color: var(--accent);
    background: #f5f8ff;
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.video-radio-card input[type="radio"]:checked + .video-radio-ui .video-radio-dot { border-color: var(--accent); }
.video-radio-card input[type="radio"]:checked + .video-radio-ui .video-radio-dot::after { transform: translate(-50%,-50%) scale(1); }
.video-radio-card input[type="radio"]:focus-visible + .video-radio-ui { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

/* ── 로고 크롭 ── */
.logo-crop-stage {
    width: 100%;
    height: calc(var(--app-vh, 1vh) * 52);
    overflow: hidden;
    background: #f4f5f7;
    border-radius: 10px;
    flex: 0 0 auto;
    position: relative;
    transform: translateZ(0);
    backface-visibility: hidden;
}
@media (max-width: 720px) { .logo-crop-stage { height: clamp(260px, calc(var(--app-vh, 1vh) * 40), 340px); } }
@media (max-width: 480px) { .logo-crop-stage { height: clamp(220px, calc(var(--app-vh, 1vh) * 32), 260px); } }

.logo-crop-panel {
    width: min(920px, 100%);
    max-height: calc(100vh - 32px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,.08), 0 32px 64px rgba(0,0,0,.16);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
@media (max-width: 480px) { .logo-crop-panel { width: 100%; max-height: calc(100vh - 20px); border-radius: 10px; } }

#logo-crop-image, .cropper-container, .cropper-wrap-box,
.cropper-canvas, .cropper-drag-box, .cropper-crop-box {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ── 기타 ── */
.address-detail-input { margin-top: 8px; }
