/* ============================================
   관리자 페이지 스타일
   ============================================ */

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

/* --- Sidebar --- */
.admin-sidebar {
    width: 240px;
    background: var(--text-main);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo {
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 700;
}
.sidebar-logo:hover { color: var(--primary-light); }

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}
.sidebar-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.9375rem;
    transition: all var(--transition);
}
.sidebar-link:hover {
    color: var(--white);
    background: rgba(255,255,255,0.08);
}
.sidebar-link.active {
    color: var(--white);
    background: var(--primary);
    font-weight: 500;
}
.sidebar-footer {
    padding: 1rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-link.logout:hover {
    color: var(--primary-light);
}

/* --- Main Content --- */
.admin-main {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    background: var(--bg-light);
}
.admin-content {
    padding: 2rem;
    max-width: 1100px;
}

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dash-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.dash-card h3 {
    font-size: 0.8125rem;
    color: var(--text-sub);
    font-weight: 500;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dash-status {
    font-size: 1.25rem;
    font-weight: 700;
}
.status-open { color: var(--success); }
.status-closed { color: var(--danger); }
.dash-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}
.dash-unit {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-sub);
    margin-left: 0.15em;
}
.dash-success { color: var(--success); }
.dash-danger { color: var(--danger); }
.dash-active { color: var(--info); }

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* --- Dashboard Row (2-col) --- */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.dash-half {
    margin-bottom: 0;
}

/* --- Mini Grid --- */
.mini-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 0;
}
.dash-card.mini {
    padding: 1rem;
}
.dash-card.mini .dash-number {
    font-size: 1.25rem;
}

/* --- Vertical Bar Chart --- */
.chart-bar-vertical {
    display: flex;
    align-items: flex-end;
    gap: 0;
    height: 160px;
    padding-top: 1rem;
}
.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.chart-count {
    font-size: 0.6875rem;
    color: var(--text-sub);
    margin-bottom: 0.25rem;
    min-height: 1em;
}
.chart-bar-wrap {
    flex: 1;
    width: 60%;
    display: flex;
    align-items: flex-end;
}
.chart-bar {
    width: 100%;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}
.chart-bar-info {
    background: var(--info);
}
.chart-label {
    font-size: 0.6875rem;
    color: var(--text-sub);
    margin-top: 0.25rem;
    white-space: nowrap;
}

/* --- Question Wrong Rate Chart --- */
.question-wrongrate-chart {
    margin-bottom: 1.5rem;
}
.qwr-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.qwr-row:last-child {
    border-bottom: none;
}
.qwr-hard {
    background: #fff5f5;
}
.qwr-easy {
    background: #f0faf0;
}
.qwr-label {
    width: 70px;
    font-size: 0.8125rem;
    font-weight: 600;
    flex-shrink: 0;
}
.qwr-bar-wrap {
    flex: 1;
    height: 18px;
    background: var(--bg-light);
    border-radius: 9px;
    overflow: hidden;
}
.qwr-bar {
    height: 100%;
    background: var(--primary-light, #EF5350);
    border-radius: 9px;
    transition: width 0.3s ease;
}
.qwr-bar.bar-danger {
    background: var(--danger);
}
.qwr-bar.bar-success {
    background: var(--success);
}
.qwr-value {
    width: 50px;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 600;
    flex-shrink: 0;
}
.qwr-detail {
    width: 60px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-sub);
    flex-shrink: 0;
}

/* --- Difficulty Summary --- */
.difficulty-summary {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.diff-block {
    flex: 1;
    padding: 1rem;
    border-radius: var(--radius-sm, 6px);
}
.diff-block h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.diff-hard {
    background: #fff5f5;
    border-left: 3px solid var(--danger);
}
.diff-hard h4 { color: var(--danger); }
.diff-easy {
    background: #f0faf0;
    border-left: 3px solid var(--success);
}
.diff-easy h4 { color: var(--success); }
.diff-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.diff-block li {
    font-size: 0.8125rem;
    padding: 0.2rem 0;
}

/* --- Badge Variants --- */
.badge-success {
    background: var(--success);
    color: var(--white);
}
.badge-danger {
    background: var(--danger);
    color: var(--white);
}
.badge-warning {
    background: var(--warning);
    color: var(--white);
}

/* --- Token Stats --- */
.token-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.token-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm, 6px);
}
.token-stat-label {
    font-size: 0.8125rem;
    color: var(--text-sub);
}
.token-stat-value {
    font-size: 0.9375rem;
    font-weight: 700;
}

/* --- Token Usage Bar --- */
.token-usage-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--border-light, #eee);
    margin-bottom: 0.5rem;
}
.tub-segment {
    transition: width 0.3s ease;
}
.tub-active { background: var(--success); }
.tub-exhausted { background: var(--danger); }

.tub-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-sub);
}
.tub-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.tub-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.tub-dot-active { background: var(--success); }
.tub-dot-exhausted { background: var(--danger); }
.tub-dot-inactive { background: var(--border-light, #eee); }

/* --- Text Helpers --- */
.text-muted-sm {
    font-size: 0.75rem;
    color: var(--text-sub);
}

/* --- Login Page --- */
.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}
.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    margin-bottom: 0.25rem;
}
.login-subtitle {
    text-align: center;
    color: var(--text-sub);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* --- Variant Card --- */
.variant-card {
    border-left: 4px solid var(--primary);
}
.variant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* --- Choices Edit --- */
.choices-edit {
    margin-bottom: 1.25rem;
}
.choice-edit-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.choice-radio-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}
.choice-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 600;
}
.choice-radio-label input:checked + .choice-number {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.choice-image-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.choice-image-preview img {
    height: 40px;
    border-radius: var(--radius-sm);
}

/* --- Image Preview --- */
.image-preview {
    margin-bottom: 0.5rem;
}
.image-preview img {
    max-height: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

/* --- Keyword Groups --- */
.keyword-group-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

/* --- Preview --- */
.preview-source-badge {
    margin-bottom: 1rem;
}
.preview-exam-style {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-light);
}
.preview-correct {
    border-color: var(--success) !important;
    background: var(--success-bg) !important;
}
.preview-subjective-info {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* --- Publish Warning --- */
.publish-warning {
    padding: 1rem;
    background: var(--warning-bg);
    color: var(--warning);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: center;
}

/* --- Variant Actions --- */
.variant-actions {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* --- Sticky Bottom --- */
.sticky-bottom {
    position: sticky;
    bottom: 0;
    background: var(--white);
    padding: 1rem 2rem;
    margin: 0 -2rem;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    z-index: 10;
}

/* --- Responsive --- */
@media (max-width: 960px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    .mini-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .difficulty-summary {
        flex-direction: column;
        gap: 0.75rem;
    }
    .token-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        position: relative;
        flex-direction: row;
        overflow-x: auto;
    }
    .sidebar-header {
        padding: 1rem;
        border-bottom: none;
        border-right: 1px solid rgba(255,255,255,0.1);
    }
    .sidebar-nav {
        display: flex;
        padding: 0;
    }
    .sidebar-link {
        white-space: nowrap;
        padding: 1rem;
    }
    .sidebar-footer {
        border-top: none;
        border-left: 1px solid rgba(255,255,255,0.1);
        padding: 0;
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-content {
        padding: 1.25rem;
    }
    .choice-edit-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
