@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --mtg-primary: #3b82f6;
    --mtg-bg-card: #ffffff;
    --mtg-text-main: #1e293b;
    --mtg-border: #e2e8f0;
}

/* =========================================================
   1. GLOBAL & GATEWAY (WELCOME SCREEN)
   ========================================================= */
.mtg-auth-wrapper, .mtg-dashboard-wrapper, .mtg-exam-wrapper { font-family: 'Poppins', sans-serif; color: var(--mtg-text-main); }
.mtg-auth-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; max-width: 900px; margin: 40px auto; }
.mtg-auth-card { background: var(--mtg-bg-card); border: 1px solid var(--mtg-border); border-radius: 12px; padding: 40px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.mtg-input { width: 100%; padding: 12px 16px; border: 2px solid var(--mtg-border); border-radius: 8px; font-size: 1rem; outline: none; }
.mtg-btn { padding: 12px 24px; border-radius: 8px; font-weight: 700; cursor: pointer; border: none; width: 100%; }
.mtg-btn-primary { background: #3b82f6; color: white; }

/* Gateway Custom */
.mtg-user-account-bar { display: flex; justify-content: flex-end; align-items: center; background: #1e293b; color: white; padding: 12px 24px; font-size: 0.95rem; gap: 15px; border-bottom: 3px solid #3b82f6; }
.mtg-logout-btn { background: #ef4444; color: white !important; text-decoration: none; padding: 6px 15px; border-radius: 6px; font-weight: 700; transition: 0.2s; }
.mtg-gateway-screen { display: flex; justify-content: center; align-items: center; min-height: 85vh; background: #f1f5f9; padding: 20px; }
.mtg-gateway-content { background: white; padding: 50px 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); text-align: center; max-width: 550px; width: 100%; border: 1px solid #e2e8f0; }
.mtg-gateway-icon { font-size: 3.5rem; margin-bottom: 20px; display: block; }
.mtg-gateway-content h3 { font-size: 1.8rem; font-weight: 800; color: #0f172a; margin-bottom: 15px; }
.mtg-gateway-btn, button[name="mtg_start_test"] { background: linear-gradient(135deg, #10b981, #059669) !important; color: white !important; font-size: 1.2rem !important; font-weight: 800 !important; padding: 15px 35px !important; border-radius: 8px !important; display: inline-block !important; text-decoration: none !important; border: none !important; cursor: pointer !important; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important; text-transform: uppercase; }

/* =========================================================
   2. EXACT HEADER (DEEP NAVY, NO BOXES)
   ========================================================= */
.mtg-exam-console { display: flex; flex-direction: column; height: 95vh; min-height: 600px; background: #ffffff; font-family: 'Inter', sans-serif; border-radius: 8px; overflow: hidden; border: 1px solid #cbd5e1; }

.mtg-exam-header { background-color: #0c1220 !important; padding: 20px 30px !important; display: flex !important; flex-direction: column !important; gap: 20px !important; border-bottom: 3px solid #1e3a8a !important; }
.mtg-header-left { display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; }
.mtg-test-title-header { font-size: 2.2rem !important; font-weight: 800 !important; color: white !important; margin: 0 !important; text-transform: uppercase !important; }
.mtg-header-left::after { content: "Question Paper"; color: #10b981 !important; font-size: 1.4rem !important; font-weight: 700 !important; }

.mtg-header-right { display: grid !important; grid-template-columns: 1fr 1fr !important; row-gap: 15px !important; column-gap: 10px !important; width: 100% !important; }
.mtg-header-stat { background: transparent !important; border: none !important; padding: 0 !important; display: flex !important; align-items: center !important; }
.mtg-stat-label { font-size: 0 !important; }

.mtg-header-stat:nth-child(1) { order: 1; justify-content: flex-start !important; }
.mtg-header-stat:nth-child(1) .mtg-stat-label::before { content: "TOTAL QS - "; font-size: 1.2rem !important; font-weight: 700 !important; color: white !important; }
.mtg-header-stat:nth-child(4) { order: 2; justify-content: flex-end !important; }
.mtg-header-stat:nth-child(4) .mtg-stat-label::before { content: "STREAK - "; font-size: 1.2rem !important; font-weight: 700 !important; color: white !important; }
.mtg-header-stat:nth-child(3) { order: 3; justify-content: flex-start !important; }
.mtg-header-stat:nth-child(3) .mtg-stat-label::before { content: "ACCURACY "; font-size: 1.2rem !important; font-weight: 700 !important; color: white !important; }
.mtg-header-stat:nth-child(3) .mtg-stat-val { color: #f28b82 !important; margin-left: 5px !important; }
.mtg-header-stat:nth-child(2) { order: 4; justify-content: flex-end !important; }
.mtg-header-stat:nth-child(2) .mtg-stat-content { background-color: #272f3d !important; padding: 5px 15px !important; border-radius: 6px !important; display: flex !important; gap: 8px !important; align-items: baseline !important;}
.mtg-header-stat:nth-child(2) .mtg-stat-label::before { content: "TIME LEFT"; font-size: 1.2rem !important; font-weight: 700 !important; color: white !important; }
.mtg-header-stat:nth-child(2) .mtg-stat-val { color: #f28b82 !important; }
.mtg-stat-val { font-size: 1.3rem !important; font-weight: 800 !important; color: white !important; }

/* FORCE HIDE ALL TRASH */
.mtg-stat-icon, .mtg-lang-stat, #google_translate_element, .goog-te-gadget, 
#mtg-review-btn, #mtg-clear-btn { 
    display: none !important; opacity: 0 !important; visibility: hidden !important; width: 0 !important; height: 0 !important; position: absolute !important; 
}

/* =========================================================
   3. QUESTION AREA & GREEN OPTIONS
   ========================================================= */
.mtg-main-layout { display: flex; flex: 1; overflow: hidden; }
.mtg-question-canvas { flex: 3; background: white; padding: 30px; display: flex; flex-direction: column; overflow-y: auto !important; overflow-x: hidden !important; border-right: 1px solid #e2e8f0; -ms-overflow-style: none !important; scrollbar-width: none !important; }
.mtg-question-canvas::-webkit-scrollbar { display: none !important; }

.mtg-progress-container { background: #1f2937; padding: 10px 16px; border-radius: 8px; display: flex; align-items: center; gap: 16px; margin-bottom: 25px; }
.mtg-motivation-text { font-weight: 800; font-size: 0.85rem; color: #3b82f6; text-transform: uppercase; }
.mtg-progress-track { flex: 1; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; }
.mtg-progress-fill { height: 100%; background: #3b82f6; border-radius: 3px; }
.mtg-marking-scheme { position: absolute; top: 10px; right: 24px; font-weight: 700; font-size: 0.85rem; }
.mtg-mark-pos { color: #10b981; } .mtg-mark-neg { color: #ef4444; }

.mtg-question-content h3 { font-size: 1.4rem; font-weight: 700; color: #1e293b; margin-bottom: 25px; line-height: 1.6; }

.mtg-option { border: 1px solid #d1d5db !important; border-radius: 8px !important; padding: 15px 20px !important; margin-bottom: 12px !important; display: flex !important; align-items: center !important; background: white !important; cursor: pointer !important; font-weight: 600 !important; color: #334155 !important; }
.mtg-option:has(input[type="radio"]:checked) { border: 2px solid #10b981 !important; background-color: #ecfdf5 !important; color: #047857 !important; }
.mtg-option input[type="radio"] { display: block !important; appearance: none !important; -webkit-appearance: none !important; width: 22px !important; height: 22px !important; border: 2px solid #6b7280 !important; border-radius: 50% !important; margin-right: 15px !important; cursor: pointer !important; flex-shrink: 0 !important; }
.mtg-option input[type="radio"]:checked { border: 6px solid #3b82f6 !important; background-color: white !important; }

/* =========================================================
   4. EXACTLY 3 BUTTONS (EQUAL & LONG)
   ========================================================= */
.mtg-action-controls {
    display: flex !important;
    justify-content: space-between !important;
    gap: 15px !important;
    width: 100% !important;
    margin-top: auto !important;
    padding-top: 20px !important;
    border-top: 1px solid #f1f5f9;
}

.mtg-action-controls button {
    flex: 1 !important; 
    height: 60px !important; 
    min-height: 60px !important;
    border-radius: 8px !important; 
    font-size: 1.1rem !important; 
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important; 
    justify-content: center !important; 
    white-space: nowrap !important;
    padding: 0 10px !important;
    border: none !important;
    cursor: pointer !important;
}

#mtg-prev-btn { background: white !important; color: #1e293b !important; border: 2px solid #cbd5e1 !important; }
#mtg-next-btn { background: #3b82f6 !important; color: white !important; }
#mtg-submit-btn, button[name="mtg_submit_test"] { background: #10b981 !important; color: white !important; } 

/* =========================================================
   5. SIDEBAR PALETTE & FOOTER (RESTORED PERFECTLY)
   ========================================================= */
.mtg-palette-sidebar { flex: 1; background: #f8fafc; border-left: 1px solid #e2e8f0; display: flex; flex-direction: column; }
.mtg-palette-header { background: #e2e8f0; padding: 12px 16px; font-weight: 800; font-size: 0.85rem; color: #475569; text-transform: uppercase; }

.mtg-palette-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 12px !important; align-content: start !important; padding: 20px !important; overflow-y: auto; }
.mtg-p-item { width: 42px !important; height: 42px !important; border-radius: 50% !important; margin: 0 auto !important; font-weight: 700 !important; font-size: 1rem !important; display: flex !important; align-items: center !important; justify-content: center !important; background: white !important; border: 1px solid #cbd5e1 !important; color: #64748b !important; cursor: pointer !important; }
.mtg-p-item.active { border: 2px solid #3b82f6 !important; color: white !important; background: #93c5fd !important; }
.mtg-p-item.attempted { background: #10b981 !important; border-color: #10b981 !important; color: white !important; }
.mtg-p-item.review { background: #f59e0b !important; border-color: #f59e0b !important; color: white !important; }

/* Restore Legend Grid */
.mtg-palette-legend { padding: 16px; background: white; border-top: 1px solid #e2e8f0; display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; font-size: 0.75rem; }
.legend-item { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #64748b; }
.dot { width: 10px; height: 10px; border-radius: 2px; }
.dot-active { border: 2px solid #3b82f6; } .dot-attempted { background: #10b981; } .dot-review { background: #f59e0b; } .dot-not-visited { background: white; border: 1px solid #cbd5e1; }

/* Restore Footer Grid */
.mtg-live-stats { background: #0f172a !important; display: grid !important; grid-template-columns: repeat(4, 1fr) !important; color: white; border-top: 1px solid #1e293b;}
.mtg-live-stat-card { padding: 16px; text-align: center; border-right: 1px solid #1e293b; }
.mtg-l-stat-val { font-size: 1.4rem; font-weight: 900; }
.mtg-l-stat-label { font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: #cbd5e1; }
.mtg-l-stat-label.attempted { color: #34d399; } .mtg-l-stat-label.review { color: #fbbf24; }
.mtg-l-stat-dark { background: #1e293b !important; } .mtg-l-stat-dark .mtg-l-stat-val { color: #3b82f6; }

/* Mobile View Adjustments */
@media screen and (max-width: 900px) {
    .mtg-main-layout { flex-direction: column; overflow-y: auto; }
    .mtg-palette-sidebar { border-left: none; border-top: 1px solid #e2e8f0; }
    .mtg-exam-console { height: auto; }
    .mtg-test-title-header { font-size: 1.8rem !important; }
    .mtg-header-left::after { font-size: 1.2rem !important; }
    .mtg-header-stat:nth-child(1) .mtg-stat-label::before,
    .mtg-header-stat:nth-child(4) .mtg-stat-label::before,
    .mtg-header-stat:nth-child(3) .mtg-stat-label::before,
    .mtg-header-stat:nth-child(2) .mtg-stat-label::before,
    .mtg-stat-val { font-size: 1.1rem !important; }
    .mtg-live-stats { position: sticky; bottom: 0; z-index: 50; }
    .mtg-action-controls { flex-direction: column !important; }
}