/* ============================================================
   后台管理样式
   ============================================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

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

/* Sidebar */
.admin-sidebar {
    width: 220px;
    min-height: 100vh;
    background: #263238;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a2329;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #009688, #4db6ac);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.sidebar-menu {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.menu-item.active {
    background: rgba(0,150,136,0.15);
    color: #fff;
    border-left-color: #009688;
}

.menu-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Main Area */
.admin-main {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.admin-topbar {
    height: 60px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background: #555;
    border-radius: 1px;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-name {
    color: #009688;
    font-weight: 600;
}

.topbar-link {
    color: #666;
    font-size: 13px;
    transition: color 0.2s;
}

.topbar-link:hover { color: #009688; }
.topbar-link.logout:hover { color: #e53935; }

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

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 24px;
}

/* ============================================================
   Dashboard Stats
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.teal { background: linear-gradient(135deg, #009688, #4db6ac); }
.stat-icon.blue { background: linear-gradient(135deg, #2196f3, #64b5f6); }
.stat-icon.orange { background: linear-gradient(135deg, #ff9800, #ffb74d); }
.stat-icon.purple { background: linear-gradient(135deg, #9c27b0, #ba68c8); }
.stat-icon.red { background: linear-gradient(135deg, #f44336, #ef5350); }
.stat-icon.green { background: linear-gradient(135deg, #4caf50, #66bb6a); }

.stat-info h4 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
}

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

table.data-table th,
table.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #ebeef5;
}

table.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

table.data-table tbody tr:hover {
    background: #f5f7fa;
}

table.data-table .actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, #009688, #4db6ac);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #00897b, #26a69a);
    box-shadow: 0 2px 8px rgba(0,150,136,0.3);
}

.btn-secondary {
    background: #fff;
    color: #666;
    border: 1px solid #dcdfe6;
}

.btn-secondary:hover {
    color: #009688;
    border-color: #009688;
}

.btn-danger {
    background: #f44336;
    color: #fff;
}

.btn-danger:hover {
    background: #e53935;
}

.btn-warning {
    background: #ff9800;
    color: #fff;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 32px;
    font-size: 16px;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.form-group label .required {
    color: #f44336;
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: #009688;
    box-shadow: 0 0 0 2px rgba(0,150,136,0.1);
}

.form-control::placeholder {
    color: #bbb;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

select.form-control {
    appearance: auto;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-hint {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* Radio & Checkbox */
.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group label, .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

/* Option row for question form */
.option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.option-label {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #666;
    flex-shrink: 0;
}

.option-row .form-control {
    flex: 1;
}

/* ============================================================
   Filters bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: flex-end;
}

.filter-bar .form-group {
    margin-bottom: 0;
}

.filter-bar .form-group label {
    margin-bottom: 4px;
    font-size: 12px;
}

.filter-bar .form-control {
    min-width: 140px;
    padding: 8px 12px;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.pagination a:hover {
    color: #009688;
    border-color: #009688;
}

.pagination .current {
    background: linear-gradient(135deg, #009688, #4db6ac);
    color: #fff;
    border-color: transparent;
}

.pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: #e8f5e9; color: #4caf50; }
.badge-warning { background: #fff3e0; color: #ff9800; }
.badge-danger  { background: #ffebee; color: #f44336; }
.badge-info    { background: #e3f2fd; color: #2196f3; }
.badge-default { background: #f5f5f5; color: #999; }
.badge-primary { background: #e0f2f1; color: #009688; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-danger  { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-info    { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #263238 0%, #37474f 50%, #009688 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0,150,136,0.1) 0%, transparent 60%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.login-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 420px;
    max-width: 90%;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #009688, #4db6ac);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
}

.login-logo h2 {
    font-size: 22px;
    color: #333;
    font-weight: 600;
}

.login-logo p {
    font-size: 14px;
    color: #999;
    margin-top: 8px;
}

.login-form .form-control {
    padding: 12px 16px;
    font-size: 15px;
}

.login-form .btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: #999;
}

.login-footer a {
    color: #009688;
}

/* ============================================================
   Misc
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #999; }
.text-success { color: #4caf50; }
.text-danger { color: #f44336; }
.text-warning { color: #ff9800; }
.text-info { color: #2196f3; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mt-2 { margin-top: 16px; }
.w-100 { width: 100%; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ddd;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-list .detail-item {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-list .detail-label {
    width: 140px;
    font-weight: 600;
    color: #666;
    flex-shrink: 0;
}

.detail-list .detail-value {
    flex: 1;
    color: #333;
}

/* Answer comparison */
.answer-compare {
    border: 1px solid #ebeef5;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.answer-compare .answer-header {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-compare .answer-body {
    padding: 12px 16px;
}

.answer-compare .answer-option {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-compare .answer-option.correct {
    color: #4caf50;
    font-weight: 600;
}

.answer-compare .answer-option.wrong {
    color: #f44336;
}

.answer-compare .answer-option .marker {
    width: 20px;
    text-align: center;
}

/* Toggle switch */
.toggle-switch {
    display: inline-block;
    position: relative;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .slider {
    background: #009688;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(22px);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.mobile-show {
        transform: translateX(0);
    }

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

    .sidebar-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .form-control {
        width: 100%;
    }

    .admin-content {
        padding: 16px;
    }

    .topbar-right .topbar-link {
        display: none;
    }

    .topbar-right .admin-name {
        font-size: 13px;
    }
}
