* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.auth-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    display: none;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    display: block;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    display: block;
}

/* Dashboard */
.dashboard {
    background: var(--bg-color);
    min-height: 100vh;
    padding: 20px;
}

.header {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h2 {
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.blocked {
    background: #fee2e2;
    color: #991b1b;
}

/* Exam List */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.exam-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.exam-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.exam-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.exam-card h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
}

.exam-card p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.exam-meta {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.exam-actions {
    margin-top: 20px;
}

/* Exam Interface */
.exam-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.exam-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    gap: 15px;
}

.exam-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.exam-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.exam-timer {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 100px;
    text-align: center;
    letter-spacing: 1px;
}

.exam-header .btn-danger {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    white-space: nowrap;
    min-width: 70px;
}

.exam-header .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.exam-header .btn-danger:active {
    transform: translateY(0);
}

.exam-body {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 0;
    min-height: 600px;
}

.question-nav {
    background: var(--bg-color);
    padding: 20px;
    border-right: 2px solid var(--border-color);
    overflow-y: auto;
    max-height: 600px;
}

.question-nav h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.question-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.question-btn:hover {
    border-color: var(--primary-color);
}

.question-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.question-btn.answered {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.question-content {
    padding: 30px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
}

.question-image-wrapper {
    margin: 0 0 25px 0 !important;
    width: 100% !important;
    display: block !important;
    flex-shrink: 0;
    order: -1; /* Şəkli ən başa köçür */
}

.question-image-container {
    width: 100%;
    display: block;
}

.question-image-container img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.question-text {
    font-size: 22px;
    margin-bottom: 30px;
    line-height: 1.8;
    color: var(--text-primary);
    flex: 1;
    min-height: 300px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: auto;
    padding-top: 20px;
}

.option {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    background: white;
    min-height: 45px;
}

.option:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.option strong {
    font-size: 16px;
    font-weight: 600;
    min-width: 24px;
}

.exam-footer {
    padding: 20px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Results */
.results-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    margin: 20px auto;
}

.results-summary {
    text-align: center;
    margin-bottom: 30px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    border: 8px solid;
}

.score-circle.passed {
    background: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.score-circle.failed {
    background: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card h4 {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 14px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Admin Panel */
.admin-container {
    background: var(--bg-color);
    min-height: 100vh;
    padding: 20px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 8px;
}

.admin-tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
}

.admin-tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.admin-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-primary);
}

.table tr:hover {
    background: var(--bg-color);
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: var(--bg-color);
}

.btn-edit:hover {
    background: #eff6ff;
}

.btn-activate:hover {
    background: #d1fae5;
}

.btn-deactivate:hover {
    background: #fef3c7;
}

.btn-delete:hover {
    background: #fee2e2;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Fullscreen Exam Mode */
.exam-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: white;
}

/* Responsive */
@media (max-width: 768px) {
    .exam-body {
        grid-template-columns: 1fr;
    }
    
    .question-nav {
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        max-height: 200px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading p {
    margin-top: 15px;
    color: var(--text-secondary);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File Upload */
input[type="file"] {
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--primary-color);
}

details {
    margin-top: 10px;
}

details summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    padding: 8px;
    background: var(--bg-color);
    border-radius: 4px;
}

details pre {
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
