/* APEX MCQ Test v2.0 - Frontend Styles */

#apex-mcq-container {
    max-width: 900px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    padding: 20px;
}

.apex-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.apex-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.apex-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 35px;
    margin-bottom: 25px;
}

.apex-card-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.apex-card-header h2 {
    color: #1a1a2e;
    font-size: 28px;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.apex-card-header p {
    color: #666;
    font-size: 15px;
    margin: 0;
}

/* Form Elements */
.apex-form-group {
    margin-bottom: 22px;
}

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

.apex-input,
.apex-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fafafa;
    box-sizing: border-box;
}

.apex-input:focus,
.apex-select:focus {
    outline: none;
    border-color: #4f46e5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.apex-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    margin-bottom: 0;
}

/* Buttons */
.apex-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.apex-btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
}

.apex-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.apex-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.apex-btn-secondary:hover {
    background: #e5e7eb;
}

.apex-btn-warning {
    background: #fef3c7;
    color: #92400e;
}

.apex-btn-warning:hover {
    background: #fde68a;
}

.apex-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.apex-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.apex-btn-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    font-size: 16px;
    padding: 16px 32px;
}

.apex-btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.apex-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.apex-btn-block {
    width: 100%;
}

/* Test Header */
.apex-test-header {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 20px 25px;
    margin-bottom: 20px;
    position: sticky;
    top: 20px;
    z-index: 100;
}

.apex-test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.apex-test-info h3 {
    margin: 0;
    color: #1a1a2e;
    font-size: 18px;
}

.apex-timer {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.apex-timer.warning {
    animation: pulse 1s infinite;
}

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

/* Progress Bar */
.apex-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.apex-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Question Card */
.apex-question-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 35px;
}

.apex-question-text {
    font-size: 18px;
    color: #1a1a2e;
    line-height: 1.6;
    margin-bottom: 25px;
    font-weight: 500;
}

/* Options */
.apex-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.apex-option {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.apex-option:hover {
    border-color: #4f46e5;
    background: #f5f3ff;
}

.apex-option.selected {
    border-color: #4f46e5;
    background: #ede9fe;
}

.apex-option input[type="radio"] {
    margin-right: 14px;
    width: 20px;
    height: 20px;
    accent-color: #4f46e5;
    flex-shrink: 0;
}

.apex-option-label {
    font-size: 15px;
    color: #374151;
    font-weight: 500;
    line-height: 1.4;
}

/* Question Actions */
.apex-question-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Tab Warning */
.apex-tab-warning {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc2626;
    color: #fff;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Results Page */
.apex-result-card {
    text-align: center;
}

.apex-result-header {
    margin-bottom: 30px;
}

.apex-result-header h2 {
    color: #1a1a2e;
    font-size: 28px;
    margin: 0;
}

.apex-result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.apex-result-stat {
    background: #f9fafb;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #e5e7eb;
}

.apex-result-stat .apex-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
}

.apex-result-stat .apex-stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 5px;
}

.apex-result-stat.pass .apex-stat-value {
    color: #10b981;
}

.apex-result-stat.fail .apex-stat-value {
    color: #dc2626;
}

.apex-whatsapp-section {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 2px solid #86efac;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.apex-whatsapp-section h3 {
    margin: 0 0 10px 0;
    color: #166534;
}

.apex-whatsapp-section p {
    color: #15803d;
    margin-bottom: 15px;
}

.apex-result-details {
    text-align: left;
    margin-bottom: 25px;
}

.apex-review-item {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.apex-review-item.correct {
    border-color: #10b981;
    background: #f0fdf4;
}

.apex-review-item.wrong {
    border-color: #dc2626;
    background: #fef2f2;
}

.apex-review-item.skipped {
    border-color: #f59e0b;
    background: #fffbeb;
}

.apex-review-question {
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
    font-size: 15px;
}

.apex-review-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.apex-review-option {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.apex-review-option.correct-ans {
    border-color: #10b981;
    background: #d1fae5;
    font-weight: 600;
}

.apex-review-option.selected {
    border-color: #4f46e5;
    background: #ede9fe;
}

.apex-review-explanation {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #1e40af;
}

/* Responsive */
@media (max-width: 600px) {
    .apex-card {
        padding: 20px;
    }

    .apex-question-card {
        padding: 20px;
    }

    .apex-test-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .apex-question-actions {
        flex-direction: column;
    }

    .apex-btn {
        width: 100%;
    }
}

/* Loading State */
.apex-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.apex-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.apex-error {
    background: #fef2f2;
    border: 2px solid #fecaca;
    color: #dc2626;
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.apex-success {
    background: #f0fdf4;
    border: 2px solid #bbf7d0;
    color: #16a34a;
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ---------- NEW HTML STYLES ---------- */
#apex-mcq-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

#apex-mcq-container::before {
    content: "📘";
    position: fixed;
    font-size: 240px;
    color: rgba(46, 125, 50, 0.07);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-12deg);
    pointer-events: none;
    z-index: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    letter-spacing: 12px;
    text-shadow: 0 0 40px rgba(46, 125, 50, 0.05);
}

#apex-mcq-container::after {
    content: "APEX";
    position: fixed;
    font-size: 120px;
    font-weight: 900;
    color: rgba(46, 125, 50, 0.04);
    bottom: 8%;
    right: 5%;
    pointer-events: none;
    z-index: 0;
    letter-spacing: 18px;
    transform: rotate(-6deg);
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.header {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 50%, #388e3c 100%);
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    border-bottom: 4px solid #a5d6a7;
    position: relative;
    border-radius: 18px 18px 0 0;
}

.header::after {
    content: "📘";
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 38px;
    opacity: 0.15;
    pointer-events: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-left .system-icon {
    font-size: 26px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 10px;
}

.header-left .system-title {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.header-left .system-title span {
    color: #a5d6a7;
    font-weight: 300;
}

.header-right .dashboard-link {
    color: #c8e6c9;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.10);
    padding: 6px 16px;
    border-radius: 30px;
    transition: 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.header-right .dashboard-link:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.student-bar {
    background: #f1f8e9;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    border-bottom: 1px solid #c8e6c9;
}

.student-id {
    font-size: 20px;
    font-weight: 700;
    color: #1b5e20;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.student-id .id-label {
    font-weight: 400;
    color: #558b2f;
    font-size: 14px;
    background: #e8f5e9;
    padding: 2px 12px;
    border-radius: 20px;
}

.student-id .id-value {
    color: #1b5e20;
    background: #ffffff;
    padding: 2px 16px;
    border-radius: 20px;
    border: 1px solid #a5d6a7;
    font-weight: 700;
}

.time-status {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.pending-time {
    font-size: 18px;
    font-weight: 700;
    color: #c0392b;
    background: #fee8e6;
    padding: 4px 18px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #f5c6c6;
}

.suspension-btn {
    background: #2e7d32;
    color: #ffffff;
    border: none;
    padding: 6px 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s ease;
    letter-spacing: 0.5px;
}

.suspension-btn:hover {
    background: #1b5e20;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.queue-bar {
    background: #ffffff;
    padding: 10px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    border-bottom: 1px solid #c8e6c9;
}

.queue-info {
    font-size: 15px;
    color: #2e3b2e;
    font-weight: 500;
}

.queue-info .highlight {
    font-weight: 700;
    color: #1b5e20;
}

.paper-name {
    font-size: 15px;
    font-weight: 600;
    color: #1b5e20;
    background: #e8f5e9;
    padding: 4px 18px;
    border-radius: 30px;
    border: 1px solid #a5d6a7;
}

.main-area {
    padding: 24px 28px 20px;
    background: #fafffe;
    min-height: 320px;
    transition: all 0.3s ease;
    position: relative;
}

.main-area::before {
    content: "📘 APEX";
    position: absolute;
    font-size: 90px;
    font-weight: 900;
    color: rgba(46, 125, 50, 0.03);
    bottom: 20px;
    right: 30px;
    pointer-events: none;
    letter-spacing: 6px;
    transform: rotate(-4deg);
}

.question-card .q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 18px;
}

.question-card .q-number {
    font-size: 18px;
    font-weight: 700;
    color: #1b5e20;
}

.question-card .q-number .q-label {
    font-weight: 400;
    color: #558b2f;
    font-size: 15px;
}

.question-card .q-meta {
    font-size: 14px;
    color: #558b2f;
    background: #e8f5e9;
    padding: 4px 16px;
    border-radius: 30px;
    border: 1px solid #a5d6a7;
}

.question-card .q-text {
    font-size: 20px;
    font-weight: 600;
    color: #1b3a1b;
    line-height: 1.6;
    margin-bottom: 22px;
    padding: 6px 0 2px 0;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 2px solid #c8e6c9;
    border-radius: 12px;
    padding: 14px 22px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.option-item:hover {
    border-color: #66bb6a;
    background: #f1f8e9;
}

.option-item input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #a5d6a7;
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.15s ease;
    position: relative;
    margin: 0;
}

.option-item input[type="radio"]:checked {
    border-color: #2e7d32;
    background: #2e7d32;
}

.option-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

.option-item .opt-label {
    font-weight: 700;
    color: #2e7d32;
    font-size: 15px;
    min-width: 26px;
}

.option-item .opt-text {
    font-size: 16px;
    color: #1b3a1b;
    font-weight: 500;
}

.option-item.selected {
    border-color: #2e7d32;
    background: #e8f5e9;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px solid #c8e6c9;
    padding-bottom: 6px;
}

.btn {
    padding: 12px 34px;
    border: none;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-skip {
    background: #f1f8e9;
    color: #2e7d32;
    border: 2px solid #a5d6a7;
}

.btn-skip:hover {
    background: #e8f5e9;
    border-color: #66bb6a;
    transform: translateY(-1px);
}

.btn-save {
    background: #2e7d32;
    color: #fff;
    border: 2px solid #2e7d32;
}

.btn-save:hover {
    background: #1b5e20;
    border-color: #1b5e20;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.30);
    transform: translateY(-1px);
}

.btn-submit {
    background: #388e3c;
    color: #fff;
    border: 2px solid #388e3c;
}

.btn-submit:hover {
    background: #1b5e20;
    border-color: #1b5e20;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.30);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.result-card {
    display: none;
    animation: fadeIn 0.5s ease;
    position: relative;
    z-index: 2;
}

.result-card .result-header {
    text-align: center;
    padding: 20px 0 10px;
    font-size: 28px;
    font-weight: 700;
    color: #1b5e20;
}

.result-card .result-header span {
    color: #2e7d32;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.result-item {
    background: #f1f8e9;
    padding: 18px 12px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #a5d6a7;
    transition: 0.2s ease;
}

.result-item .r-value {
    font-size: 32px;
    font-weight: 800;
    color: #1b5e20;
    line-height: 1.2;
}

.result-item .r-label {
    font-size: 14px;
    color: #558b2f;
    margin-top: 4px;
}

.result-item.correct .r-value {
    color: #2e7d32;
}
.result-item.incorrect .r-value {
    color: #c0392b;
}
.result-item.attempted .r-value {
    color: #1b5e20;
}
.result-item.percentage .r-value {
    color: #f57c00;
}

.result-grade {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    padding: 16px;
    background: #e8f5e9;
    border-radius: 60px;
    color: #1b5e20;
    margin-top: 10px;
    border: 2px solid #a5d6a7;
}

.result-grade .grade-badge {
    display: inline-block;
    background: #2e7d32;
    color: #fff;
    padding: 4px 28px;
    border-radius: 40px;
    font-size: 28px;
    margin-left: 12px;
}

.progress-section {
    padding: 0 28px 16px;
    background: #fafffe;
    border-radius: 0 0 18px 18px;
}

.progress-section .progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #4a5b4a;
    margin-bottom: 4px;
}

.progress-section .progress-meta .q-counter {
    font-weight: 600;
    color: #1b5e20;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: #c8e6c9;
    border-radius: 12px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2e7d32, #66bb6a);
    border-radius: 12px;
    transition: width 0.35s ease;
}

@media (max-width: 768px) {
    .header { padding: 14px 18px; }
    .header-left .system-title { font-size: 17px; }
    .student-bar {
        padding: 12px 18px;
        flex-direction: column;
        align-items: flex-start;
    }
    .student-bar .time-status {
        width: 100%;
        justify-content: space-between;
    }
    .queue-bar {
        padding: 10px 18px;
        flex-direction: column;
        align-items: flex-start;
    }
    .main-area { padding: 18px 18px 16px; }
    .question-card .q-text { font-size: 18px; }
    .option-item { padding: 12px 16px; }
    .action-bar { justify-content: center; }
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        flex: 1;
        justify-content: center;
    }
    .result-grid { grid-template-columns: repeat(2, 1fr); }
    #apex-mcq-container::before { font-size: 120px; }
    #apex-mcq-container::after { font-size: 60px; }
}

@media (max-width: 480px) {
    .header-left .system-title { font-size: 15px; }
    .header-right .dashboard-link {
        font-size: 12px;
        padding: 4px 12px;
    }
    .student-id {
        font-size: 15px;
        flex-wrap: wrap;
    }
    .pending-time {
        font-size: 15px;
        padding: 3px 14px;
    }
    .question-card .q-text { font-size: 16px; }
    .option-item .opt-text { font-size: 14px; }
    .btn {
        padding: 9px 16px;
        font-size: 13px;
    }
    .result-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .result-item .r-value { font-size: 24px; }
    .main-area::before { font-size: 50px; }
}
