/* ========== 관리자 PC 데스크톱 레이아웃 ========== */
:root {
    --admin-sidebar-w: 240px;
    --admin-header-h: 56px;
    --admin-bg: #F8FAFC;
    --admin-card-bg: #FFFFFF;
    --admin-border: #E5E7EB;
    --admin-text: #111827;
    --admin-muted: #6B7280;
    --admin-primary: #3B82F6;
    --admin-primary-light: #EFF6FF;
}

/* 모바일 레이아웃 무효화 */
.admin-page,
.admin-page body {
    background: var(--admin-bg);
}

.admin-page .app-container {
    max-width: none !important;
    box-shadow: none !important;
    background: var(--admin-bg) !important;
    flex-direction: row !important;
    min-height: 100vh;
}

.admin-page .header,
.admin-page .bottom-nav,
.admin-page .fab-btn {
    display: none !important;
}

.admin-page .main-content {
    padding: 0 !important;
}

/* ========== Layout ========== */
.admin-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.admin-sidebar {
    width: var(--admin-sidebar-w);
    background: #FFFFFF;
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.admin-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    color: var(--admin-text);
    letter-spacing: -0.3px;
}

.admin-brand-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
}

.admin-nav {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-nav-section {
    font-size: 11px;
    font-weight: 700;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 14px 12px 6px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--admin-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s;
}

.admin-nav-link:hover {
    background: #F3F4F6;
}

.admin-nav-link.active {
    background: var(--admin-primary-light);
    color: var(--admin-primary);
    font-weight: 600;
}

.admin-nav-link i {
    width: 18px; height: 18px;
}

.admin-nav-link .badge {
    margin-left: auto;
    background: #EF4444;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    padding: 2px 7px;
    font-weight: 700;
}

.admin-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--admin-border);
}

.admin-user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
}

.admin-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.admin-user-info {
    flex: 1; min-width: 0;
}

.admin-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.admin-user-role {
    font-size: 11px;
    color: var(--admin-muted);
}

/* ========== Main ========== */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-w);
    min-width: 0;
    padding: 24px 32px 60px;
}

.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.admin-page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--admin-text);
    letter-spacing: -0.4px;
}

.admin-page-subtitle {
    font-size: 13px;
    color: var(--admin-muted);
    margin-top: 4px;
}

/* ========== Cards / Stats ========== */
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.admin-stat {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 16px 18px;
}

.admin-stat-label {
    font-size: 12px;
    color: var(--admin-muted);
    font-weight: 600;
    margin-bottom: 6px;
    display: flex; align-items: center; gap: 6px;
}

.admin-stat-label i { width: 14px; height: 14px; }

.admin-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--admin-text);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.admin-stat-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--admin-muted);
}

.admin-stat-meta .up { color: #10B981; font-weight: 600; }
.admin-stat-meta .warn { color: #F59E0B; font-weight: 600; }

/* ========== Card / Section ========== */
.admin-card {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 18px;
}

.admin-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--admin-text);
}

.admin-card-body {
    padding: 14px 18px;
}

.admin-card-body.tight { padding: 0; }

/* ========== Tables ========== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 10px 14px;
    background: #F9FAFB;
    color: var(--admin-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #F3F4F6;
    color: var(--admin-text);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #F9FAFB;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ========== Badges ========== */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}
.admin-badge-success { background: #D1FAE5; color: #065F46; }
.admin-badge-warning { background: #FEF3C7; color: #92400E; }
.admin-badge-danger  { background: #FEE2E2; color: #991B1B; }
.admin-badge-muted   { background: #E5E7EB; color: #374151; }
.admin-badge-info    { background: #DBEAFE; color: #1E40AF; }
.admin-badge-purple  { background: #EDE9FE; color: #5B21B6; }

/* ========== Buttons ========== */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    background: #fff;
    color: var(--admin-text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.admin-btn:hover { background: #F9FAFB; border-color: #D1D5DB; }
.admin-btn i { width: 14px; height: 14px; }

.admin-btn-primary {
    background: var(--admin-primary);
    border-color: var(--admin-primary);
    color: #fff;
}
.admin-btn-primary:hover { background: #2563EB; border-color: #2563EB; }

.admin-btn-success {
    background: #10B981;
    border-color: #10B981;
    color: #fff;
}
.admin-btn-success:hover { background: #059669; border-color: #059669; }

.admin-btn-danger {
    background: #EF4444;
    border-color: #EF4444;
    color: #fff;
}
.admin-btn-danger:hover { background: #DC2626; border-color: #DC2626; }

.admin-btn-sm {
    padding: 5px 9px;
    font-size: 11.5px;
}

/* ========== Filters ========== */
.admin-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-input,
.admin-select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: var(--admin-text);
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.admin-input:focus,
.admin-select:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.admin-input { min-width: 220px; }

.admin-tabs {
    display: flex;
    gap: 4px;
    background: #F3F4F6;
    border-radius: 9px;
    padding: 3px;
}
.admin-tab {
    padding: 6px 14px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--admin-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.admin-tab.active {
    background: #fff;
    color: var(--admin-text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ========== Empty / Spinner ========== */
.admin-empty {
    text-align: center;
    padding: 36px 16px;
    color: var(--admin-muted);
    font-size: 13px;
}

.admin-loading {
    text-align: center;
    padding: 28px;
    color: var(--admin-muted);
    font-size: 13px;
}

.admin-spinner {
    width: 16px; height: 16px;
    border: 2px solid #E5E7EB;
    border-top-color: var(--admin-primary);
    border-radius: 50%;
    animation: admin-spin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* ========== Modal ========== */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.admin-modal-overlay.show { display: flex; }
.admin-modal {
    background: #fff;
    border-radius: 14px;
    width: 540px;
    max-width: 92vw;
    max-height: 86vh;
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.admin-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex; align-items: center; justify-content: space-between;
}
.admin-modal-title { font-size: 15px; font-weight: 700; }
.admin-modal-close {
    background: none; border: none; cursor: pointer;
    width: 30px; height: 30px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--admin-muted);
}
.admin-modal-close:hover { background: #F3F4F6; }
.admin-modal-body { padding: 18px 20px; overflow-y: auto; }
.admin-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--admin-border);
    display: flex; gap: 8px; justify-content: flex-end;
}

.admin-form-row {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 12px;
}
.admin-form-row label {
    font-size: 12px; font-weight: 600; color: var(--admin-muted);
}

/* ========== Bar Chart ========== */
.admin-bar-chart {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 120px;
    padding: 8px 4px 0;
}
.admin-bar-col {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.admin-bar {
    width: 100%;
    background: linear-gradient(180deg, #93C5FD 0%, #3B82F6 100%);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-bar-label {
    font-size: 10px;
    color: var(--admin-muted);
    white-space: nowrap;
}

/* ========== Toast ========== */
.admin-toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: #111827;
    color: #fff;
    padding: 10px 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    z-index: 300;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
}
.admin-toast.show { transform: translateY(0); opacity: 1; }
.admin-toast.error { background: #DC2626; }
.admin-toast.success { background: #059669; }

/* ========== Mobile Top Bar (mobile only) ========== */
.admin-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid var(--admin-border);
    padding: 10px 14px;
    align-items: center;
    gap: 10px;
    height: var(--admin-header-h);
}
.admin-topbar-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: var(--admin-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-iconbtn {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--admin-text);
}
.admin-iconbtn:hover { background: #F9FAFB; }

.admin-sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 99;
}
.admin-sidebar-backdrop.show { display: block; }

/* ========== Card-mode Table (used on mobile, hidden on desktop) ========== */
.admin-cardlist {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}
.admin-cardlist-item {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex; flex-direction: column;
    gap: 8px;
}
.admin-cardlist-row {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    font-size: 12.5px;
}
.admin-cardlist-row .k {
    color: var(--admin-muted);
    font-weight: 600;
    font-size: 11.5px;
}
.admin-cardlist-row .v {
    color: var(--admin-text);
    text-align: right;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 60%;
}
.admin-cardlist-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: 4px;
}
.admin-cardlist-actions .admin-btn {
    flex: 1;
    justify-content: center;
}

/* ========== Mobile Layout ========== */
@media (max-width: 880px) {
    .admin-topbar { display: flex; }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }
    .admin-sidebar.open { transform: translateX(0); }

    .admin-main {
        margin-left: 0;
        padding: 0;
    }

    .admin-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
        padding: 14px 14px 0;
    }
    .admin-page-title { font-size: 19px; }
    .admin-page-subtitle { font-size: 12px; }

    .admin-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 14px;
        margin-bottom: 14px;
    }
    .admin-stat { padding: 12px 14px; }
    .admin-stat-value { font-size: 22px; }
    .admin-stat-label { font-size: 11px; }
    .admin-stat-meta { font-size: 11px; }

    /* Dashboard 의 2열 그리드를 1열로 */
    .admin-main > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        padding: 0 14px;
    }

    .admin-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-bottom: 12px;
    }
    .admin-card-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
    }
    .admin-card-body { padding: 12px 14px; }

    /* 필터 바 모바일 풀너비 */
    .admin-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
    }
    .admin-filter-bar .admin-input,
    .admin-filter-bar .admin-select { width: 100%; min-width: 0; }
    .admin-filter-bar > span { text-align: right; }

    /* 가로 스크롤 가능한 탭 */
    .admin-tabs {
        overflow-x: auto;
        white-space: nowrap;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    .admin-tab { font-size: 12px; padding: 6px 10px; }

    /* PC 테이블은 모바일에서 카드형으로 */
    .admin-table-wrapper { display: none !important; }
    .admin-cardlist { display: flex !important; }

    /* PC에서 stat-grid 대시보드 그래프 컨테이너 */
    .admin-bar-chart { height: 100px; }
    .admin-bar-label { font-size: 9px; }

    /* 모달은 화면에 가득 */
    .admin-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .admin-modal-body { padding: 14px; }
    .admin-modal-footer {
        padding: 10px 14px;
        position: sticky;
        bottom: 0;
        background: #fff;
    }
    .admin-modal-footer .admin-btn { flex: 1; justify-content: center; }

    /* 모바일에서는 사이드바 숨김 처리 시 메인이 차지하므로 footer 적용 */
    .admin-toast { left: 14px; right: 14px; bottom: 14px; text-align: center; }
}

