/* ===== 관리자 스타일 ===== */
* { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary: #8b3a3a;
    --primary-dark: #5c2626;
    --primary-light: #b55a4a;
    --bg: #f5f0eb;
    --white: #ffffff;
    --gray: #666;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple SD Gothic Neo', sans-serif;
    background: var(--bg);
    color: #222;
    display: flex;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #2d2d3d);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 32px;
    color: var(--primary);
}
.login-header p {
    color: #888;
    font-size: 15px;
    margin-top: 4px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #1a1a2e;
    color: white;
    padding: 20px 0;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 22px;
    color: #d4a373;
}

.role-badge {
    display: inline-block;
    background: rgba(212,163,115,0.2);
    color: #d4a373;
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 20px;
    margin-top: 4px;
}

.sidebar-nav {
    padding: 16px 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(212,163,115,0.15);
    color: #d4a373;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 30px 40px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.top-bar h2 {
    font-size: 24px;
    color: var(--primary-dark);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== Language Toggle (개선됨) ===== */
.lang-toggle {
    display: flex;
    gap: 4px;
    background: #e8e0d8;
    border-radius: 20px;
    padding: 4px;
    border: 2px solid #d4a373;
}

.lang-toggle button {
    background: transparent;
    border: none;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: #888;
    transition: all 0.3s ease;
}

.lang-toggle button:hover {
    color: #5c2626;
}

.lang-toggle button.active {
    background: #8b3a3a;
    color: white;
    box-shadow: 0 2px 8px rgba(139, 58, 58, 0.3);
}

.lang-toggle button.active:hover {
    background: #6d2e2e;
    color: white;
}

/* 다크 모드 대응 */
@media (prefers-color-scheme: dark) {
    .lang-toggle {
        background: #3d3d3d;
        border-color: #d4a373;
    }
    .lang-toggle button {
        color: #aaa;
    }
    .lang-toggle button.active {
        background: #d4a373;
        color: #1a1a2e;
    }
    .lang-toggle button:hover {
        color: #fff;
    }
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-info h3 {
    font-size: 24px;
    color: var(--primary-dark);
}
.stat-info p {
    font-size: 13px;
    color: var(--gray);
}

/* ===== Table ===== */
.table-responsive {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: #faf8f6;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray);
    border-bottom: 1px solid #eee;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0ebe5;
}

.table tr:hover td {
    background: #faf8f6;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: #2e7d32; color: white; }
.btn-success:hover { background: #1b5e20; }

.btn-danger { background: #c62828; color: white; }
.btn-danger:hover { background: #b71c1c; }

.btn-secondary { background: #78909c; color: white; }
.btn-secondary:hover { background: #546e7a; }

.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

.btn-outline-danger { background: transparent; border: 2px solid #c62828; color: #c62828; }
.btn-outline-danger:hover { background: #c62828; color: white; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; color: #444; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e8e0d8;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #faf8f6;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.half { flex: 1; }

/* ===== Alert ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-error { background: #ffebee; color: #c62828; }
.alert-info { background: #e3f2fd; color: #0d47a1; }
.alert-warning { background: #fff3e0; color: #e65100; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: var(--radius);
    max-width: 560px;
    width: 90%;
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-close {
    font-size: 28px;
    color: #999;
    text-decoration: none;
    cursor: pointer;
}

/* ===== Category Grid ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.category-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}
.category-card:hover {
    transform: translateY(-4px);
}

.category-icon { font-size: 32px; margin-bottom: 8px; }
.category-info h3 { font-size: 16px; color: var(--primary-dark); }
.category-key { font-size: 12px; color: #aaa; }
.category-count { font-size: 13px; color: var(--gray); margin-top: 4px; }
.category-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

/* ===== Status Badge ===== */
.status-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .top-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
    .top-bar-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .table-responsive { font-size: 12px; }
    .table th, .table td { padding: 8px 10px; }
    .category-grid { grid-template-columns: 1fr 1fr; }
    .modal { padding: 20px; }
    .login-box { padding: 30px 20px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: 1fr; }
    .lang-toggle button { padding: 4px 12px; font-size: 12px; }
    .btn { padding: 8px 14px; font-size: 13px; }
}

/* ===== 하단 모바일 네비게이션 ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    padding: 6px 0 env(safe-area-inset-bottom, 8px) 0;
    z-index: 1000;
    border-top: 1px solid #f0ebe5;
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    text-decoration: none;
    color: #999;
    font-size: 10px;
    transition: all 0.2s;
    min-width: 50px;
    gap: 2px;
}

.bottom-nav a .icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav a .label {
    font-size: 10px;
    font-weight: 500;
}

.bottom-nav a:hover {
    color: #666;
}

.bottom-nav a.active {
    color: #8b3a3a;
}

.bottom-nav a.active .icon {
    transform: scale(1.05);
}

/* ===== 모바일에서만 하단 메뉴 표시 ===== */
@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }
    
    .main-content {
        padding-bottom: 80px;
    }
    
    /* 사이드바 숨김 */
    .sidebar {
        display: none;
    }
    
    /* 상단바 모바일 최적화 */
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .top-bar-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-info h3 {
        font-size: 20px;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px 10px;
    }
    
    .category-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .modal {
        padding: 20px;
        width: 95%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
}

@media (max-width: 400px) {
    .bottom-nav a {
        padding: 2px 6px;
        min-width: 40px;
    }
    .bottom-nav a .icon {
        font-size: 18px;
    }
    .bottom-nav a .label {
        font-size: 9px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .category-grid {
        grid-template-columns: 1fr;
    }
}