/* assets/css/style.css */

/* =========================================
   1. General Styles
   ========================================= */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --dark-text: #343a40;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: #fff;
    padding: 20px 0;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    text-align: center;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 25px;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
}

.btn-success {
    background: var(--success-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
}


/* =========================================
   2. Landing Page Styles
   ========================================= */

.hero-section {
    background: var(--gradient-primary);
    color: white;
    padding: 60px 0;
    text-align: center;
    border-radius: 0 0 20px 20px;
    /* Slight curve at bottom */
    margin-bottom: 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hero-title {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.hero-subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.exam-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.exam-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
}

.exam-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.exam-title {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.exam-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 1.05em;
    color: #555;
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-icon {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* =========================================
   3. TCS Pattern Styles (Test Interface)
   ========================================= */
body.tcs-body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background-color: #fff;
    background-color: #fff;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Mobile friendly */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 13px;
    user-select: none;
    /* Security: Disables Text Selection */
}

/* Header */
.tcs-header {
    background: #fff;
    border-bottom: 1px solid #ccc;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
}

.logo-area {
    font-size: 14px;
    font-weight: bold;
    width: 100%;
    text-align: left;
}

/* Info Bar */
.info-bar {
    background: #4A90E2;
    color: #fff;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    height: 35px;
}

/* Layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fff;
    min-height: 0;
    /* Allow shrinking in flex column */
}

/* Responsive adjustments (Mobile TCS) */
@media (max-width: 768px) {
    body.tcs-body {
        font-size: 12px;
    }

    /* Compact Header */
    .tcs-header {
        height: auto;
        flex-direction: column;
        padding: 10px;
        gap: 5px;
    }

    .logo-area {
        text-align: center;
        font-size: 12px;
    }

    .profile-header-info {
        display: none;
    }

    /* Save space */

    /* Info Bar */
    .info-bar {
        height: 40px;
        padding: 0 10px;
    }

    #mobile-palette-btn {
        display: inline-block !important;
    }

    /* Layout */
    .main-container {
        position: relative;
    }

    /* For absolute sidebar */

    .question-area {
        width: 100%;
        border-right: none;
    }

    /* Sidebar Drawer */
    .sidebar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 80%;
        /* Takes up most of screen */
        max-width: 300px;
        z-index: 1000;
        transform: translateX(100%);
        /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    }

    .sidebar.open {
        transform: translateX(0);
        /* Slide in */
    }

    /* Footer Buttons Stack/Scroll */
    .footer-bar {
        position: fixed;
        bottom: 10px;
        left: 0;
        /* width: 100%; */
        z-index: 1000;
        height: auto;
        margin-bottom: 5px;

        display: flex;
        /* Ensure flex is active */
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;

        padding: 5px;
        padding-bottom: 5px;
        padding-bottom: max(5px, env(safe-area-inset-bottom));

        border-top: 1px solid #ccc;
        background: #fff;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    }

    .footer-left,
    .footer-right {
        display: flex;
        gap: 5px;
        width: 100%;
        justify-content: space-between;
    }

    .tcs-btn {
        flex: 1;
        font-size: 11px;
        padding: 8px 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        height: auto;
    }

    .desktop-text {
        display: none !important;
    }

    .mobile-text {
        display: inline !important;
    }

    /* Ensure main container doesn't get covered by fixed footer */
    .main-container {
        padding-bottom: 0px;
        /* Space for footer */
    }
}

.mobile-text {
    display: none;
}

.question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ccc;
}

.question-header {
    padding: 8px 15px;
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    background: #fff;
    color: #d11200;
}

.question-box-scroll {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 15px;
    background: #fff;
    line-height: 1.5;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #E4E9F0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ccc;
    flex-shrink: 0;
}

.candidate-info {
    background: #fff;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #ccc;
    height: 60px;
}

.candidate-icon {
    width: 50px;
    height: 50px;
    border: 1px solid #aaa;
    background: #eee;
}

.profile-icon {
    border-radius: 50%;
    background: #eee;
    padding: 2px;
    border: 1px solid #ccc;
}

/* Palette Legend */
.palette-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 8px;
    font-size: 11px;
    background: #fff;
    border-bottom: 1px solid #ccc;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Palette Badges & Buttons Shared Styles */
.badge,
.palette-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: 500;
    font-size: 15px;
    cursor: default;
    border: 1px solid #aaa;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 1px rgba(0, 0, 0, 0.1);
}

.palette-btn {
    cursor: pointer;
    margin: 0;
}

/* Shapes & Colors (TCS Replica) */

/* Not Visited: Greyish White Box */
.status-0,
.badge.not-visited {
    background: #E0E0E0;
    color: #000;
    border-radius: 2px;
    border-color: #ccc;
}

/* Not Answered: Red Box (Slightly Rounded) */
.status-1,
.badge.not-answered {
    background: #D9534F;
    /* Soft Red */
    color: #fff;
    border-radius: 2px;
    border-color: #d43f3a;
    /* Clip path to look like 'tag' shape sometimes used, but screenshot shows box */
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    padding-bottom: 2px;
}

/* Answered: Green Box (Slightly Rounded) */
.status-2,
.badge.answered {
    background: #5CB85C;
    /* Bootstrap Green-ish */
    color: #fff;
    border-radius: 2px;
    border-color: #4cae4c;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    padding-bottom: 2px;
}

/* Marked for Review: Purple Circle */
.status-3,
.badge.marked {
    background: #7B5EA6;
    color: #fff;
    border-radius: 50%;
    border-color: #5a4b7e;
    box-shadow: none;
    /* Circles usually flat or simple shadow */
}

/* Active Question Highlight (Black Border) */
.palette-btn.active {
    border: 2px solid #000 !important;
    transform: scale(1.05);
    z-index: 2;
}

/* Grid Area */
.section-selector {
    padding: 8px 10px;
    background: #3c8dbc;
    color: white;
    font-weight: bold;
    font-size: 13px;
}

.section-selector select {
    width: 100%;
    border: none;
    padding: 2px;
}

.palette-grid {
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 Columns Fixed */
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
    background: #E4E9F0;
}

/* Header for Grid matches 'Choose a Question' from screenshot */
.palette-grid::before {
    content: 'Choose a Question';
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

/* Footer */
.footer-bar {
    height: 50px;
    background: #fff;
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
    /* Critical: Prevent shrinking/disappearing */
    z-index: 50;
    /* Ensure above other content */
    position: relative;
}

.tcs-btn {
    padding: 6px 12px;
    border: 1px solid #aaa;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    border-radius: 2px;
}

.btn-white {
    background: #fff;
    color: #000;
}

.btn-white:hover {
    background: #f0f0f0;
}

.btn-blue {
    background: #337AB7;
    color: white;
    border-color: #2e6da4;
}

.btn-blue:hover {
    background: #286090;
}

.btn-purple {
    background: #5bc0de;
    color: #fff;
    border-color: #46b8da;
}

/* Cyan for Mark Rev */
.btn-green {
    background: #5cb85c;
    color: white;
    border-color: #4cae4c;
}

/* Options */
.option-row {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px;
}

.option-row:hover {
    background: #f9f9f9;
}

.option-row input[type="radio"] {
    margin-top: 3px;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #fff;
    color: #333;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    border-left: 5px solid #333;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: #28a745;
}

.toast.success .icon {
    color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.error .icon {
    color: #dc3545;
}

.toast.info {
    border-left-color: #17a2b8;
}

.toast.info .icon {
    color: #17a2b8;
}

.toast .close-btn {
    margin-left: auto;
    cursor: pointer;
    color: #999;
    font-weight: bold;
}

/* --- CUSTOM MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-title {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #333;
}

.modal-content {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.modal-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}

.modal-btn.primary {
    background: #007bff;
    color: white;
}

.modal-btn.primary:hover {
    background: #0056b3;
}

.modal-btn.danger {
    background: #dc3545;
    color: white;
}

.modal-btn.danger:hover {
    background: #a71d2a;
}

.modal-btn.secondary {
    background: #e2e6ea;
    color: #333;
}

.modal-btn.secondary:hover {
    background: #dbe0e5;
}