/* 机电科协培训营题库系统 - 工业机械风格 */

/* ============ CSS Variables ============ */
:root {
    /* Industrial Metal Palette */
    --bg-dark: #1a1a1a;
    --bg-panel: #252525;
    --bg-card: #2d2d2d;
    --bg-input: #1f1f1f;

    /* Metal Colors */
    --metal-dark: #3d3d3d;
    --metal-light: #5a5a5a;
    --metal-highlight: #7a7a7a;

    /* Accent - Molten Orange */
    --accent-orange: #ff6b00;
    --accent-orange-glow: #ff8c33;
    --accent-amber: #ffb800;

    /* Status Colors */
    --success: #00c853;
    --danger: #ff3d00;
    --warning: #ffab00;

    /* Text Colors */
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    /* Border Colors */
    --border-dark: #404040;
    --border-light: #505050;

    /* Shadows */
    --shadow-glow: 0 0 20px rgba(255, 107, 0, 0.3);
}

/* ============ Base Styles ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ============ Typography ============ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: var(--accent-orange);
    text-decoration: none;
}

a:hover {
    color: var(--accent-orange-glow);
}

/* ============ Container ============ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============ Header ============ */
header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-dark) 100%);
    border-bottom: 3px solid var(--accent-orange);
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 2.2rem;
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
}

.logo p {
    color: var(--text-secondary);
    font-size: 1rem;
    letter-spacing: 2px;
}

/* ============ Cards ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.card h2, .card h3 {
    color: var(--accent-orange);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-dark);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

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

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

/* ============ Buttons ============ */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #cc5500 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-orange-glow) 0%, var(--accent-orange) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--metal-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--metal-light);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #cc3100 100%);
    color: #fff;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff5722 0%, var(--danger) 100%);
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    margin-right: 5px;
}

.btn-small.btn-primary {
    background: var(--accent-orange);
    color: #fff;
}

.btn-small.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-small.btn-secondary {
    background: var(--metal-dark);
    color: var(--text-primary);
}

/* ============ Messages ============ */
.message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 15px;
    display: none;
}

.message.error {
    background: rgba(255, 61, 0, 0.15);
    color: #ff6b4a;
    border: 1px solid var(--danger);
    display: block;
}

.message.success {
    background: rgba(0, 200, 83, 0.15);
    color: #69f0a8;
    border: 1px solid var(--success);
    display: block;
}

/* ============ Info Section ============ */
.info-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 25px;
}

.info-section h3 {
    color: var(--accent-amber);
    margin-bottom: 15px;
}

.info-section ul {
    list-style: none;
}

.info-section li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-secondary);
}

.info-section li:last-child {
    border-bottom: none;
}

.info-section li strong {
    color: var(--accent-orange);
}

/* ============ Homepage Layout ============ */
.homepage-layout {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.left-column {
    flex: 1;
    min-width: 0;
}

.right-column {
    width: 380px;
    flex-shrink: 0;
}

.ranking-card {
    position: sticky;
    top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 20px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.ranking-card h3 {
    color: var(--accent-amber);
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-dark);
}

.ranking-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.ranking-list::-webkit-scrollbar {
    width: 6px;
}

.ranking-list::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.ranking-list::-webkit-scrollbar-thumb {
    background: var(--metal-dark);
    border-radius: 3px;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-dark);
    transition: background 0.2s;
}

.ranking-item:hover {
    background: rgba(255, 107, 0, 0.05);
}

.ranking-item.gold {
    background: linear-gradient(90deg, rgba(255, 184, 0, 0.1) 0%, transparent 100%);
}

.ranking-item.silver {
    background: linear-gradient(90deg, rgba(180, 180, 180, 0.08) 0%, transparent 100%);
}

.ranking-item.bronze {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, transparent 100%);
}

.rank-number {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: var(--metal-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    margin-right: 12px;
    flex-shrink: 0;
    border: 1px solid var(--border-light);
}

.ranking-item.gold .rank-number {
    background: linear-gradient(135deg, #ffb800 0%, #ff8c00 100%);
    color: #1a1a1a;
    border: none;
}

.ranking-item.silver .rank-number {
    background: linear-gradient(135deg, #c0c0c0 0%, #888888 100%);
    color: #1a1a1a;
    border: none;
}

.ranking-item.bronze .rank-number {
    background: linear-gradient(135deg, #cd7f32 0%, #a05a2c 100%);
    color: #fff;
    border: none;
}

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

.rank-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-class {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rank-score {
    text-align: right;
    margin-left: 12px;
}

.score-main {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-orange);
}

.score-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.loading, .no-data {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

/* ============ Exam Page ============ */
.exam-container {
    min-height: 100vh;
    background: var(--bg-dark);
}

.exam-header {
    background: var(--bg-panel);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-orange);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.exam-header h1 {
    font-size: 1.2rem;
    color: var(--accent-orange);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.timer {
    background: var(--bg-input);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Consolas', monospace;
    border: 1px solid var(--border-dark);
    color: var(--text-primary);
}

.timer.warning {
    background: rgba(255, 171, 0, 0.15);
    color: var(--warning);
    border-color: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-info {
    font-size: 1rem;
    color: var(--text-secondary);
}

.exam-content {
    flex: 1;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.question-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    min-height: 300px;
}

.question-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.question-type {
    background: var(--accent-orange);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.question-category {
    background: var(--metal-dark);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.question-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-input);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-dark);
}

.option-label:hover {
    border-color: var(--accent-orange);
    background: rgba(255, 107, 0, 0.05);
}

.option-label input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-orange);
}

.fill-input {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-primary);
}

.fill-input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.control-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 20px;
}

.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.nav-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-dark);
    background: var(--bg-input);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.nav-btn:hover {
    border-color: var(--accent-orange);
    color: var(--text-primary);
}

.nav-btn.current {
    background: var(--accent-orange);
    color: #fff;
    border-color: var(--accent-orange);
}

.nav-btn.subjective.current {
    background: var(--accent-orange);
    color: #fff;
    border-color: var(--accent-orange);
}

.nav-btn.answered {
    background: rgba(0, 200, 83, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.nav-btn.subjective {
    background: rgba(255, 184, 0, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.nav-btn.subjective.answered {
    background: rgba(0, 200, 83, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ============ Modals ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
}

.modal h2 {
    color: var(--accent-orange);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-dark);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ============ Result Modal ============ */
.result-modal {
    text-align: center;
}

.result-summary {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}

.result-score-card {
    text-align: center;
}

.result-score-card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 3px solid var(--accent-orange);
    color: var(--accent-orange);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    font-size: 2.5rem;
    font-weight: bold;
}

.score-circle.objective {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.score-circle.subjective {
    border-color: var(--warning);
    color: var(--warning);
}

.score-circle small {
    font-size: 0.9rem;
    margin-top: 5px;
    color: var(--text-muted);
}

.score-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 10px;
}

.ranking-info {
    background: var(--bg-panel);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.ranking-info p {
    color: var(--text-secondary);
}

.ranking-info strong {
    color: var(--accent-orange);
    font-size: 1.3rem;
}

.result-actions {
    text-align: center;
}

/* ============ Admin Page ============ */
.admin-container {
    min-height: 100vh;
    background: var(--bg-dark);
}

.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

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

.admin-header {
    background: var(--bg-panel);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-orange);
}

.admin-header h1 {
    font-size: 1.2rem;
    color: var(--accent-orange);
}

.admin-tabs {
    background: var(--bg-panel);
    padding: 0 30px;
    display: flex;
    gap: 5px;
    border-bottom: 1px solid var(--border-dark);
}

.tab-btn {
    padding: 15px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--accent-orange);
}

.tab-btn.active {
    color: var(--accent-orange);
    border-bottom-color: var(--accent-orange);
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--accent-orange);
}

.table-scroll-container {
    max-height: 400px;
    overflow-y: auto;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-item {
    background: var(--bg-input);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-dark);
}

/* ============ Tables ============ */
.data-table {
    width: 100%;
    background: var(--bg-card);
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-dark);
}

.data-table th {
    background: var(--bg-panel);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.data-table tbody tr:hover {
    background: rgba(255, 107, 0, 0.03);
}

.data-table .question-content {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ Status Badges ============ */
.status-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.selected {
    background: rgba(0, 200, 83, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-badge.pending {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-dark);
}

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

.card-header h3 {
    color: var(--accent-orange);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ============ Filter Bar ============ */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-bar select {
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    color: var(--text-primary);
}

/* ============ Selection Info ============ */
.selection-info {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    background: var(--bg-panel);
    padding: 15px 20px;
    border-radius: 6px;
    border: 1px solid var(--border-dark);
}

.selection-info strong {
    color: var(--accent-orange);
}

/* ============ Hint Text ============ */
.hint {
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============ Footer ============ */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-dark);
    margin-top: auto;
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
    .homepage-layout {
        flex-direction: column;
    }

    .right-column {
        width: 100%;
    }

    .exam-header {
        flex-direction: column;
        gap: 10px;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-tabs {
        overflow-x: auto;
    }

    .card-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .result-summary {
        flex-direction: column;
    }
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--metal-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--metal-light);
}
