
body {
    background-color: #FFFFFF;
    color: #555555;
    font-family: Arial, sans-serif;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #416871;
}

.card-text,
label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #555555;
}

.main-layout {
    display: flex;
    align-items: flex-start;
    gap: 2%;
    position: relative;
}

.questionnaire-section {
    flex: 0 0 90%;
}

.page-buttons {
    flex: 0 0 18%;
    min-width: 180px;
    max-width: 200px;
    position: sticky;
    top: 5%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid #C9DEE4;
    border-radius: 0.5rem;
    box-shadow: 0 0 10px rgba(65, 104, 113, 0.1);
    background-color: #EAF3F5;
    overflow-y: auto;
}

.page-btn {
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.35rem;
    min-height: 36px;
    border-width: 1px;
    border-style: solid;
    border-color: #C9DEE4;
    color: #416871;
    background-color: #F5FAFB;
    transition: all 0.2s ease;
}

.page-btn:hover {
    background-color: #6CB0BD;
    border-color: #416871;
    color: white;
}

.page-btn.active,
.page-btn.active:active {
    background-color: #416871 !important;
    color: white !important;
    border-color: #416871 !important;
    box-shadow: 0 0 0 0.2rem rgba(65, 104, 113, 0.25);
}

.page-btn.completed {
    background-color: #6CB0BD !important;
    color: white !important;
    border-color: #6CB0BD !important;
}

.save-button-wrapper {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

.button-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.answered-card {
    border-left: 5px solid #6CB0BD;
    background-color: #EAF3F5;
    position: relative;
}

.answered-card::after {
    content: "\2713 Answered";
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: #6CB0BD;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}

.btn-primary {
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.35rem;
    background-color: #416871;
    border-color: #416871;
    color: white;
}

.btn-primary:hover,
.btn-primary:active {
    background-color: #6CB0BD !important;
    border-color: #6CB0BD !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(108, 176, 189, 0.25);
}

.page-btn:focus,
.page-btn:focus-visible,
.page-btn:active,
.page-btn:focus:active {
    background-color: #416871 !important;
    border-color: #36545B !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(54, 84, 91, 0.25) !important;
    outline: none !important;
}

.custom-alert {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background-color: #EAF3F5;
    color: #416871;
    border-left: 4px solid #6CB0BD;
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(65, 104, 113, 0.15);
    z-index: 9999;
    display: none;
    max-width: 230px;
    font-size: 0.875rem;
    font-family: system-ui, sans-serif;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-alert.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.info-icon {
    display: inline-block;
    margin-left: 0.5rem;
    font-weight: bold;
    font-family: Arial, sans-serif;
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    text-align: center;
    border-radius: 50%;
    background-color: #6CB0BD;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 0 4px rgba(65, 104, 113, 0.2);
}

.info-icon:hover {
    background-color: #416871;
}

.backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: none;
}

.info-popup {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid #C9DEE4;
    padding: 1rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
    max-width: 600px;
    width: 90vw;
    z-index: 10;
    display: none;
    overflow: auto;
    max-height: 600px;
    white-space: normal;
    line-height: 1.5;
    background-color: #FFFFFF;
    backdrop-filter: none;
}


.info-popup::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
}

@media (max-width: 500px) {
    .info-popup {
        font-size: 0.85rem;
        max-width: 95vw;
        left: 50%;
        transform: translateX(-50%);
    }
}

#submitBox {
    position: sticky;
    top: 70px;
    display: flex;
    justify-content: center;
    z-index: 100;
}

.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 5%;
    gap: 0.5rem;
}

/* Back/Logout button style */
.position-relative .btn-outline-secondary {
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
    height: 32px;
    line-height: 1.2;
    border-radius: 0.35rem;
    border: 1px solid #416871;
    color: #416871;
    background-color: #F5FAFB;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
}

.position-relative .btn-outline-secondary:hover {
    background-color: #416871;
    color: white;
    border-color: #416871;
    box-shadow: 0 0 0 0.15rem rgba(65, 104, 113, 0.25);
}

/* Styled spinner to match button theme */
.custom-spinner {
    width: 1rem;
    height: 1rem;
    border: 3px solid rgba(255, 255, 255, 0.4); /* faded ring */
    border-top-color: #FFFFFF; /* solid part */
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* Match Sidebar Save Button to the Submit Button style */
#sidebar-save-btn {
    background-color: #416871 !important;  /* Match submit default */
    border-color: #C9DEE4 !important;      /* Match submit border */
    color: white !important;               /* Text color */
    box-shadow: none !important;
    padding: 0.35rem 0.65rem !important;   /* match page-btn / submit height */
    min-height: 36px !important;
    line-height: 1.2 !important;
    border-radius: 0.35rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    width: 100%;                           /* Spans sidebar width */
    border-style: solid;
    border-width: 1px;
}

#sidebar-save-btn:hover {
    background-color: #6CB0BD !important;  /* Match submit hover */
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(65, 104, 113, 0.25) !important;
}

#sidebar-save-btn:active {
    background-color: #416871 !important;
    color: white !important;
    box-shadow: none !important;
}

#submitBox > .btn-primary {
    background-color: #416871 !important;  /* default color */
    border-color: #C9DEE4 !important;      /* keep border */
    color: white !important;               /* text color */
    box-shadow: none !important;           /* remove shadow */
    padding: 0.35rem 0.65rem !important;   /* same as page-btn */
    min-height: 36px !important;           /* same as page-btn */
    line-height: 1.2 !important;           /* consistent */
    border-radius: 0.35rem;                /* match page-btn */
    font-size: 0.875rem;                   /* match page-btn */
    transition: all 0.2s ease;             /* smooth hover */
}

#submitBox > .btn-primary.btn-primary:hover {
    background-color: #6CB0BD !important;  /* same as page-btn hover */
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(65, 104, 113, 0.25) !important; /* match page-btn */
}

#submitBox > .btn-primary.btn-primary:active {
    background-color: #416871 !important;  /* prevent blue on press */
    color: white !important;
    box-shadow: none !important;
}






/* --- Confirmation Popup --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(65, 104, 113, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.popup-overlay.show {
    display: flex;
}

.popup-box {
    background: #ffffff;
    border: 1px solid #C9DEE4;
    border-left: 4px solid #6CB0BD;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(65, 104, 113, 0.2);
    max-width: 400px;
    width: 90%;
    padding: 1.5rem;
    text-align: center;
    color: #416871;
}

.popup-box h5 {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.popup-box p {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.popup-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}




/* ============================================================
   FULL SITE HISTORICAL THEME (ORANGE OVERRIDES)
   ============================================================ */


/* 2. Sidebar Container */
.theme-historical .page-buttons {
    border: 1px solid #FAD7BB !important;
    background-color: #FEF5ED !important;
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.1) !important;
}

/* 3. Page Navigation Buttons */
.theme-historical .page-btn {
    border-color: #FAD7BB !important;
    color: #A04000 !important;
    background-color: #FFFBF7 !important;
}

.theme-historical .page-btn:hover {
    background-color: #FAD7BB !important;
    color: #D35400 !important;
}

.theme-historical .page-btn.active,
.theme-historical .page-btn.active:active,
.theme-historical .page-btn.active:focus {
    background-color: #E67E22 !important;
    border-color: #D35400 !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(230, 126, 34, 0.25) !important;
}

.theme-historical .page-btn.completed {
    background-color: #FAD7BB !important;
    color: #D35400 !important;
    border-color: #E67E22 !important;
}

/* 4. Action Buttons (Save, Download, Submit - Orange for Historical) */
.theme-historical .btn-primary,
.theme-historical #submit-btn,
.theme-historical #sidebar-save-btn,
.theme-historical #download-btn,
.theme-historical #generate-link-btn {
    background-color: #E67E22 !important;
    border-color: #D35400 !important;
    color: white !important;
}

/* Specific Style for Logout/Back in Historical Mode (Removing the Orange) */
.theme-historical .btn-outline-secondary {
    border-color: #6c757d !important;      /* Standard grey border */
    color: #6c757d !important;             /* Standard grey text */
}

.theme-historical .btn-outline-secondary:hover {
    background-color: #6c757d !important;
    color: white !important;
}

.theme-historical .btn-primary:hover,
.theme-historical #submit-btn:hover,
.theme-historical .btn-outline-secondary:hover {
    background-color: #D35400 !important;
    border-color: #BA4A00 !important;
}

/* 5. Question Cards */
.theme-historical .question-card {
    border-color: #FAD7BB !important;
}

.theme-historical .card-title {
    color: #D35400 !important;
}

/* REPLACING CHECKMARK WITH YEAR LABEL */
.theme-historical .answered-card {
    border-left: 5px solid #E67E22 !important;
    background-color: #FEF5ED !important;
}

.theme-historical .answered-card::after {
    content: "\2713 Answer from " attr(data-year) !important;
    background-color: #E67E22 !important;
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 6. Info Icon and Popups */
.theme-historical .info-icon {
    background-color: #E67E22 !important;
}

.theme-historical .info-icon:hover {
    background-color: #D35400 !important;
}

.theme-historical .info-popup {
    border-left: 4px solid #FAD7BB !important;
}

/* 7. Alerts and Confirmation Popups */
.theme-historical .custom-alert {
    background-color: #FEF5ED !important;
    color: #A04000 !important;
    border-left: 4px solid #E67E22 !important;
}

.theme-historical .popup-overlay {
    background: rgba(230, 126, 34, 0.2) !important;
}

.theme-historical .popup-box {
    border-left: 4px solid #E67E22 !important;
    color: #D35400 !important;
}

/* 8. Disabled Inputs (Make them readable but clearly inactive) */
.theme-historical .response-select:disabled {
    background-color: #FFFBF7 !important;
    border-color: #FAD7BB !important;
    opacity: 0.8;
}

/* --- Remove Blue Focus/Active Hue for Orange Buttons --- */

/* Targets the primary buttons, page buttons, and submit button within the orange theme */
.theme-historical .btn-primary:focus,
.theme-historical .btn-primary:active,
.theme-historical #submit-btn:focus,
.theme-historical #submit-btn:active,
.theme-historical .page-btn.active:focus,
.theme-historical .page-btn.active:active {
    /* Change the blue glow to an orange one */
    box-shadow: 0 0 0 0.25rem rgba(230, 126, 34, 0.25) !important;
    outline: none !important;
}

/* Specifically for when the button is being clicked (active) */
.theme-historical .btn-primary:active,
.theme-historical #submit-btn:active {
    background-color: #BA4A00 !important; /* Slightly darker orange on click */
    border-color: #A04000 !important;
}

/* Ensure the sidebar page buttons also lose the blue glow */
.theme-historical .page-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(230, 126, 34, 0.15) !important;
}

/* --- ULTIMATE REMOVAL OF BLUE OUTLINE ON PAGE BUTTONS --- */

/* 1. Target the specific page-btn class in historical mode */
.theme-historical .page-btn:active:focus,
.theme-historical .page-btn:focus,
.theme-historical .page-btn:active,
.theme-historical .page-btn.active:focus,
.theme-historical .page-btn.active:active {
    /* Set the shadow to orange with !important to crush Bootstrap defaults */
    box-shadow: 0 0 0 0.25rem rgba(230, 126, 34, 0.25) !important;

    /* Ensure the border doesn't revert to blue/teal */
    border-color: #D35400 !important;

    /* Remove any standard browser outline */
    outline: none !important;
}

/* 2. Overwrite the default Bootstrap 'button' transitions that might leak blue */
.theme-historical .btn:active:focus,
.theme-historical .btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(230, 126, 34, 0.25) !important;
}

/* 3. Specifically for the side buttons in the grid */
.theme-historical .page-buttons .page-btn:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(230, 126, 34, 0.25) !important;
    outline: none !important;
}


/* --- 1:1 Match of Blue Hover Behavior for Orange Theme --- */

.theme-historical .btn-primary:hover,
.theme-historical #download-btn:hover,
.theme-historical #submit-btn:hover,
.theme-historical #sidebar-save-btn:hover,
.theme-historical #generate-link-btn:hover {
    /* Lighter orange for the button body on hover (Matches blue's lighter tint) */
    background-color: #F39C12 !important;
    border-color: #E67E22 !important;
    color: white !important;

    /* Matching the "hue" (box-shadow) logic from the blue theme */
    box-shadow: 0 0 0 0.2rem rgba(230, 126, 34, 0.25) !important;
}

/* Ensure the transition is smooth just like the blue theme */
.theme-historical .btn-primary,
.theme-historical #download-btn,
.theme-historical #submit-btn {
    transition: all 0.2s ease;
}

/* Fix the "Active" (click-down) state to stay solid orange */
.theme-historical .btn-primary:active,
.theme-historical #download-btn:active {
    background-color: #E67E22 !important;
    box-shadow: none !important;
}
