/* --- CORE VARIABLES & RESET --- */
:root {
    --bg-body: #ececec;
    --bg-white: #ffffff;
    --header-dark: #293846;
    --uscpa-blue: #232325;
    --accent-orange: #d74c15;
    --accent-green: #28a745;
    --text-dark: #333333;
    --text-light: #555555;
    --border-color: #dcdcdc;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.1);
    --font-main: "Open Sans", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--bg-body);
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-dark);
    font-size: 14px;
}

/* --- UTILITY CLASSES --- */
.flex { display: flex; }
.full-height { height: 100%; }

/* --- BUTTONS --- */
.btn {
    border: none;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.btn-primary {
    background-color: var(--header-dark);
    color: white;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    background-color: #1a252f; /* Slightly darker shade of your header color */
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
/* Dashboard Section Headers */
.grid-section { margin-bottom: 30px; }
.grid-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
}
.grid-section-title i { color: var(--accent-orange); }
.grid-wrapper { display: flex; flex-wrap: wrap; gap: 10px; }

/* Primary "Check Answer" Button */
.btn-check {
    background-color: var(--accent-orange);
    color: white;
    padding: 12px 40px;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(215, 76, 21, 0.3);
}
.btn-check:hover {
    background-color: #b43e10;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(215, 76, 21, 0.4);
}

/* Ghost Button (Header Exit) */
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    padding: 6px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.1);
    border-color: white;
}

/* Dark Ghost for Modals */
.btn-ghost-dark { background: transparent; border: 1px solid #ccc; color: #666; }
.btn-ghost-dark:hover { background: #f0f0f0; color: #333; }

/* Danger Button */
.btn-danger { background-color: #dc3545; color: white; }
.btn-danger:hover { background-color: #c82333; }

/* Danger Outline (Reset) */
.btn-danger-outline {
    background: white;
    border: 1px solid #dc3545;
    color: #dc3545;
}
.btn-danger-outline:hover { background: #fff5f5; }

/* --- CARD LAYOUT --- */
.card-stage {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}
.card {
    background: var(--bg-white);
    max-width: 900px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 4px;
    display: flex; flex-direction: column;
}
.card-header {
    background: var(--header-dark);
    color: white;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-brand.clickable { cursor: pointer; transition: opacity 0.2s; }
.header-brand.clickable:hover { opacity: 0.8; }

.card-body { padding: 40px; }
.card-footer {
    padding: 20px 40px;
    display: flex;
    flex-direction: column; /* Changed from default row to column to stack items */
    align-items: center;    /* Center content horizontally */
    justify-content: center;
    border-top: 1px solid #eee;
    gap: 25px; /* Adds space between the button and the text */
}
.footer-legal {
    text-align: center;
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}
.footer-legal p {
    margin: 0 0 4px 0;
}
/* --- TABS --- */
.bank-tabs-container {
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}
.bank-tabs { 
    display: flex; justify-content: center; gap: 20px;
}
.bank-tab {
    padding: 15px 35px;
    cursor: pointer; font-weight: 700; color: #777;
    border-bottom: 4px solid transparent; 
    margin-bottom: -7px;
    font-size: 16px;
    transition: all 0.2s;
}
.bank-tab:hover { color: var(--accent-orange); background: #fdfdfd; }
.bank-tab.active { 
    color: var(--accent-orange); 
    border-bottom-color: var(--accent-orange); 
    background: white; 
}

/* --- EXAM UI STRUCTURE --- */
#exam-ui { display: flex; flex-direction: column; height: 100vh; }

.exam-header {
    background: var(--bg-white); 
    border-bottom: 1px solid var(--border-color);
    display: flex; flex-direction: column; 
    box-shadow: 0 1px 4px rgba(0,0,0,0.05); 
    z-index: 100;
    flex-shrink: 0;
}
.top-blue-bar {
    background: var(--header-dark); height: 50px; color: white;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; font-size: 16px; font-weight: 700;
}
.testlet-compass {
    display: flex; background: #f3f3f3; height: 35px; border-bottom: 1px solid #ddd;
    align-items: center; padding-left: 20px;
}
.compass-item {
    font-size: 12px; color: #888; margin-right: 20px;
    display: flex; align-items: center; gap: 6px;
}
.compass-item.active { color: var(--accent-orange); font-weight: bold; }
.compass-icon-box i { font-size: 14px; }
.compass-item.active .compass-icon-box { color: var(--accent-orange); }

/* --- WORKSPACE & CONTENT --- */
.workspace { 
    flex: 1; 
    display: flex; 
    background: #ececec; 
    padding: 8px; 
    justify-content: center; 
    overflow: hidden; 
}

.content-panel {
    flex: 0 1 1000px; /* Base width */
    background: white; 
    border-left: 4px solid var(--accent-orange);
    max-width: 1000px; 
    width: 95%; 
    height: 100%; 
    min-height: 0;
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ========================================= */
/* --- UNIFIED QUESTION INTERFACE (MCQ & TBS) --- */
/* ========================================= */

/* 1. Main Container */
.study-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* 2. Unified Header */
.study-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 15px 25px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fff;
}
.q-title-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-orange);
    line-height: 1;
    min-width: 80px; 
    text-align: center;
}
/* Navigation Arrows */
.nav-triangle-btn {
    background: none; border: none; cursor: pointer; color: #555;
    font-size: 18px; padding: 5px; display: flex;
    align-items: center; justify-content: center;
}
.nav-triangle-btn:hover:not(:disabled) { color: var(--accent-orange); }
.nav-triangle-btn:disabled { color: #ddd; cursor: default; }
.nav-triangle-btn.large { font-size: 24px; }

/* Bookmark Button */
.btn-bookmark {
    background: transparent;
    border: 1px solid #ddd;
    color: #ccc;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}
.btn-bookmark:hover { border-color: #aaa; color: #aaa; }
.btn-bookmark.active { color: #d74c15; border-color: #d74c15; }

/* 3. Unified Scroll Pane */
.study-scroll-pane {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    padding: 0; 
}

/* 4. Unified Content Wrapper (Same size for MCQ and TBS) */
.study-content-wrap {
    width: 100%;
    max-width: 850px; 
    margin: 0 auto;   
    padding: 30px 25px 60px 25px; 
    display: flex;
    flex-direction: column;
}

/* --- QUESTION COMPONENTS --- */

/* Prompt / Question Text */
.question-prompt {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* TBS Instructions */
.tbs-instructions {
    background: #f8f9fa;
    border-left: 4px solid var(--uscpa-blue);
    padding: 15px;
    margin-bottom: 25px;
    font-size: 15px;
    line-height: 1.5;
    color: #444;
}

/* MCQ Options */
.mcq-option {
    display: flex; 
    align-items: flex-start; 
    padding: 15px 20px; 
    margin-bottom: 12px;
    cursor: pointer; 
    border: 1px solid #e0e0e0; 
    border-radius: 8px;
    background: white; 
    transition: all 0.15s ease-in-out;
}
.mcq-option:hover { background-color: #fcfcfc; border-color: #bbb; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.mcq-option.selected { background-color: #e8f0fe; border-color: #d2e3fc; }

.radio-circle {
    width: 22px; height: 22px; 
    border: 2px solid #999; 
    border-radius: 50%;
    margin-right: 15px; 
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s;
}
.mcq-option.selected .radio-circle { border-color: var(--uscpa-blue); }
.mcq-option.selected .radio-circle::after {
    content: ''; width: 12px; height: 12px; 
    background: var(--uscpa-blue); 
    border-radius: 50%;
}

/* TBS Table */
.tbs-table-container {
    width: 100%;
    margin-bottom: 25px;
    overflow-x: auto; 
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tbs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
    table-layout: auto; 
}

.tbs-table th {
    background: var(--header-dark);
    color: white;
    padding: 12px 15px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap; 
}
.tbs-table th:first-child, .tbs-table td:first-child {
    min-width: 50px; 
}
.tbs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}
.tbs-table tr:last-child td { border-bottom: none; }
.tbs-table tr:nth-child(even) td { background-color: #fbfbfb; }

.tbs-input {
    width: 100%;
    max-width: 150px; 
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: right; 
    display: block;
    margin: 0 auto; 
}
.tbs-input:focus { border-color: var(--accent-orange); outline: none; }
.tbs-input.correct { border-color: #28a745; background-color: #e6ffec; }

/* Explanation & Footer */
.action-row-centered {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}
.explanation-box {
    margin-top: 10px; padding: 25px;
    background: #fff8f0; border-left: 4px solid #ffeeba;
    color: #333; display: none; line-height: 1.6;
    border-radius: 4px;
}
.explanation-box.show { display: block; animation: fadeIn 0.4s; }
.exp-header { font-weight: bold; margin-bottom: 10px; color: #856404; display: flex; align-items: center; gap: 8px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.nav-bottom-bar-centered {
    margin-top: 30px;
    display: flex; justify-content: center; align-items: center;
    gap: 60px; padding: 20px 0;
    border-top: 1px solid #f5f5f5;
}

/* --- DASHBOARD GRID --- */
.q-grid-item {
    width: 50px; height: 50px;
    border: 1px solid #eee;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
    background: #fdfdfd; border-radius: 4px;
    font-weight: 600; color: #555;
    transition: all 0.2s;
}
.q-grid-item:hover { border-color: var(--accent-orange); transform: translateY(-2px); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.q-grid-item.correct { background-color: #d4edda; border-color: #c3e6cb; color: #155724; }
.q-grid-item.wrong { background-color: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.q-grid-status-icon { position: absolute; bottom: 3px; right: 3px; font-size: 10px; }
.grid-bookmark-flag {
    position: absolute; top: -4px; left: 4px;
    color: #d74c15; font-size: 14px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
    z-index: 2;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
    z-index: 3000; pointer-events: none;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background-color: #333; color: #fff;
    padding: 12px 20px; border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px; font-weight: 600;
    opacity: 0; transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; align-items: center; gap: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background-color: #d74c15; color: white; }
.toast.success { background-color: #28a745; color: white; }

/* --- CUSTOM MODAL --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    z-index: 2000; display: none;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s; }

.modal-box {
    background: white; width: 400px; max-width: 90%;
    border-radius: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden; animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-header {
    padding: 15px 20px; background: #f8f9fa; border-bottom: 1px solid #eee;
    font-weight: 700; display: flex; align-items: center; gap: 10px; color: #333;
}
.modal-body { padding: 25px 20px; font-size: 15px; color: #555; line-height: 1.5; }
.modal-footer {
    padding: 15px 20px; display: flex; justify-content: flex-end; gap: 10px;
    background: #fdfdfd; border-top: 1px solid #eee;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- NEW TBS STYLES --- */

/* Exhibits Container */
.exhibits-wrapper {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 30px;
    background: #f9f9f9;
    overflow: hidden;
}
.exhibits-header {
    background: #eee;
    padding: 8px 15px;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    border-bottom: 1px solid #ddd;
}
.exhibits-tabs {
    display: flex;
    background: #f1f1f1;
    border-bottom: 1px solid #ddd;
    
    /* ADDED FOR SCROLLING */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
    
    /* OPTIONAL: Hide Scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}

.exhibits-tabs::-webkit-scrollbar {
    display: none;
}
.exhibit-tab {
    background: transparent;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    border-right: 1px solid #ddd;
    flex-shrink: 0;
    white-space: nowrap;
}
.exhibit-tab:hover { background: #e9e9e9; }
.exhibit-tab.active {
    background: white;
    color: var(--accent-orange);
    border-bottom: 2px solid var(--accent-orange);
    margin-bottom: -1px;
}
.exhibit-content {
    display: none;
    padding: 20px;
    background: white;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100px;
}
.exhibit-content.active { display: block; animation: fadeIn 0.2s; }

/* Hybrid Items (Sub-sections) */
.tbs-section {
    margin-bottom: 35px;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tbs-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--uscpa-blue);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Journal Entry Dropdowns */
select.tbs-input {
    width: 100%;
    min-width: 180px;
    text-align: left;
    padding: 8px;
    background: white;
}
select.tbs-input.correct-text {
    border-color: #28a745;
    color: #155724;
    font-weight: bold;
    background-color: #e6ffec;
}

/* [style.css] Add these new classes */

.tbs-feedback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 4px;
    min-width: 80px;
    min-height: 38px; /* Match input height roughly */
}

.tbs-feedback .user-val {
    text-decoration: line-through;
    color: #dc3545;
    font-size: 11px;
    margin-bottom: 2px;
}

.tbs-feedback .corr-val {
    color: #28a745;
    font-weight: bold;
    font-size: 13px;
}

/* Ensure table cells have enough height */
.tbs-table td {
    height: 60px;
}

/* Mini MCQ Group */
.mini-mcq-box {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dotted #eee;
}
.mini-mcq-box:last-child { border-bottom: none; }
.mini-prompt { font-weight: 600; margin-bottom: 10px; color: #444; }
.mini-opts { display: flex; flex-direction: column; gap: 8px; }
.mini-mcq-opt {
    display: flex; align-items: center;
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.mini-mcq-opt:hover { background: #f9f9f9; }
.mini-mcq-opt .radio-circle { width: 16px; height: 16px; margin-right: 10px; border-width: 1px; }
.intro-alert {
    display: inline-flex;
    width: fit-content;
    margin: 15px auto 15px auto;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-content {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.4;
}

.alert-content a {
    color: var(--header-dark);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dotted var(--header-dark);
}

.alert-content a:hover {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}
.dashboard-intro {
    background: #fff;
    text-align: center;
}
.dashboard-intro h2 {
    color: var(--header-dark);
    margin: 20px 0 10px 0;
    font-size: 24px;
}
.dashboard-intro p {
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    font-size: 15px;
    line-height: 1.5;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .intro-alert {
        padding: 6px 10px;
        gap: 10px;
    }
    .alert-content {
        font-size: 12px;
    }
    .dashboard-intro p {
        font-size: 12px;
        line-height: 1.5;
    }
    .btn {
        font-size: 12px;
    }
    /* 1. Global Layout */
    .card-stage { padding: 0; align-items: flex-start; background: white; }
    .card { box-shadow: none; border-radius: 0; min-height: 100vh; }
    .card-body { padding: 10px 5px; }
    .grid-section-title { font-size: 12px; margin-bottom: 10px; padding: 4px; gap: 2px; }
    
    /* 2. Dashboard */
    .bank-tabs { flex-wrap: wrap; gap: 10px; }
    .bank-tab { text-align: center; padding: 6px 10px; font-size: 12px; }
    #grid-container > div { justify-content: center; padding: 4px;}
    .q-grid-item { width: 50px; height: 30px; }
    
    /* 3. Exam Header */
    .top-blue-bar { padding: 0 10px; }
    .header-brand span {
        font-size: 14px; max-width: calc(100vw - 90px); 
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .btn-ghost { padding: 6px 10px; }
    .btn-ghost span { display: none; }
    .btn-ghost i { margin: 0; font-size: 16px; }
    
    /* 4. Workspace */
    .workspace { padding: 0; }
    .content-panel {
        width: 100%; max-width: 100%;
        border-left: none; border-top: 4px solid var(--accent-orange);
    }
    
    /* Updated Mobile Target */
    .study-content-wrap { padding: 20px; }
    
    .tbs-instructions { font-size: 12px; }
    .tbs-table { font-size: 11px; table-layout: auto; width: 100%; }
    .tbs-table th { padding: 8px 4px; font-size: 10px; text-transform: uppercase; white-space: nowrap; }
    .tbs-table td { padding: 6px 4px; }
    input.tbs-input { 
        font-size: 16px;
        scale: 0.8;
        min-width: 60px !important; 
    }
    select.tbs-input { 
        font-size: 16px;
        scale: 0.8;
        min-width: 120px !important; 
        width: 100%;
    }

    /* 5. Question Interface */
    .q-title-text { font-size: 14px; }
    .question-prompt { font-size: 14px; }
    .nav-triangle-btn { padding: 10px 15px; }
    .mcq-option { padding: 15px 10px; font-size: 14px;}
    
    .action-row-centered { width: 100%; padding: 0 20px; margin: 20px 0; }
    .btn-check, .btn-danger-outline { width: 80%; display: flex; justify-content: center; padding: 10px; }

    .nav-bottom-bar-centered { justify-content: space-between; gap: 10px; padding: 15px 20px; }
    .modal-box { width: 90%; margin: 0 auto; }
    
    select.tbs-input {
        width: 100%;
        max-width: 100%;
    }
}