@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy:        #002366;
    --navy-dark:   #001a4d;
    --navy-light:  #0a3278;
    --gold:        #e8a020;
    --gold-hover:  #d4901a;
    --sidebar-w:   240px;
    --topbar-h:    60px;
    --bg:          #f0f2f7;
    --surface:     #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --muted:       #64748b;
    --radius:      8px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
    --shadow:      0 2px 8px rgba(0,0,0,.1);
    --success:     #16a34a;
    --danger:      #dc2626;
    --warning:     #d97706;
    --info:        #2563eb;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────── */
.admin-wrap { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: #374151;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    flex-shrink: 0;
}
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .logo-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: -.3px;
    text-decoration: none;
    display: block;
}
.sidebar-logo .logo-sub {
    font-size: .72rem;
    color: rgba(255,255,255,.5);
    margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    padding: 12px 20px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
    background: rgba(232,160,32,.12);
    color: var(--gold);
    border-left-color: var(--gold);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .8rem;
    color: rgba(255,255,255,.4);
}

/* Main area */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { font-size: .85rem; color: var(--muted); }
.topbar-logout {
    font-size: .8rem;
    color: var(--danger);
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    transition: all .15s;
}
.topbar-logout:hover { background: var(--danger); color: #fff; }

/* Content */
.admin-content { padding: 28px; flex: 1; }

/* ── Cards ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title { font-size: .9rem; font-weight: 700; color: var(--navy); }
.card-body { padding: 20px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--navy);
}
.stat-card.gold::before  { background: var(--gold); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before   { background: var(--danger); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-sub   { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.tbl th {
    background: #f8fafc;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
table.tbl td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
    vertical-align: middle;
}
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-pending   { background: #fef9c3; color: #854d0e; }
.badge-reviewing { background: #dbeafe; color: #1e40af; }
.badge-active    { background: #dcfce7; color: #166534; }
.badge-approved  { background: #dcfce7; color: #166534; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-rejected  { background: #fee2e2; color: #991b1b; }
.badge-expired   { background: #f3f4f6; color: #6b7280; }
.badge-paid      { background: #dcfce7; color: #166534; }
.badge-failed    { background: #fee2e2; color: #991b1b; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-size: .83rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--navy);    color: #fff; }
.btn-primary:hover  { background: var(--navy-dark); color: #fff; }
.btn-gold     { background: var(--gold);    color: #fff; }
.btn-gold:hover     { background: var(--gold-hover); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--navy); }
select.form-control { cursor: pointer; }
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }

/* ── Filters / toolbar ───────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar-right { margin-left: auto; }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 1.25rem; line-height: 1;
    padding: 4px;
}
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Temp password highlight */
.temp-pw-box {
    background: #fef9c3;
    border: 2px dashed var(--gold);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: .1em;
    text-align: center;
    margin: 12px 0;
}
.temp-pw-warning {
    font-size: .78rem;
    color: var(--danger);
    text-align: center;
    margin-bottom: 12px;
}

/* Two-column layout */
.content-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.content-grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* Alert */
.alert { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .85rem; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Login page ──────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    background: var(--surface);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .name { font-size: 1.3rem; font-weight: 800; color: var(--navy); }
.login-logo .sub  { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── 햄버거 버튼 ─────────────────────────────────────── */
.hamburger {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 36px; height: 36px; padding: 6px; background: none; border: none;
    cursor: pointer; border-radius: 8px; flex-shrink: 0;
}
.hamburger span {
    display: block; width: 20px; height: 2px;
    background: var(--navy); border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── 모바일 오버레이 ─────────────────────────────────── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 89;
    background: rgba(0,0,0,.45);
}
.sidebar-overlay.open { display: block; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid-2, .content-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .sidebar {
        transform: translateX(-100%); transition: transform .25s ease;
        z-index: 90; box-shadow: 4px 0 20px rgba(0,0,0,.18);
    }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-row-2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 12px; gap: 10px; }
    .topbar-user { display: none; }
    .topbar-title { font-size: .9rem; }
    .tbl th, .tbl td { font-size: .8rem; padding: 8px 10px; }
    .btn { font-size: .78rem; }
    .card-header { flex-wrap: wrap; gap: 8px; }
    .admin-content { padding: 16px 12px; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .topbar-right .btn { display: none; }
}
