/* ------------------------- */
/* --- THEMES AND COLORS --- */
/* ------------------------- */
:root {
    --font-default: 'Archivo', sans-serif;

    /* Text styles */
    --style-title: 700 clamp(20px, 5.31vw, 28px)/1.3 var(--font-default);
    --style-headline: 700 clamp(16px, 4.11vw, 19px)/1.3 var(--font-default);
    --style-body: 400 clamp(16px, 4.11vw, 19px)/1.4 var(--font-default);
    --style-button: 700 clamp(16px, 4.11vw, 19px)/1.2 var(--font-default);
    --style-note: 400 clamp(12px, 3.14vw, 15px)/1.4 var(--font-default);
}

html[data-theme='dark'] {
    --color-background: #000000;
    --color-surface: #2C2C2E;
    --color-text-primary: #FFFFFF;
    --color-text-disabled: #9FA09F;
    --color-interactive: #20C4F4;
    --color-interactive-text: #000000;
    --color-border: #9FA09F;
    --color-brand: #20C4F4;
    --color-border-rgba: rgba(159, 160, 159, 0.2);
    --bottom-nav-background: --color-background;
}

html[data-theme='light'] {
    --color-background: #F2F2F7;
    --color-surface: #FFFFFF;
    --color-text-primary: #000000;
    --color-text-disabled: #6E6E73;
    --color-interactive: #1E9AC8;
    --color-interactive-text: #FFFFFF;
    --color-border: #6E6E73;
    --color-brand: #1E9AC8;
    --color-border-rgba: rgba(110, 110, 115, 0.2);
    --bottom-nav-background: --color-background;
}

html[data-theme='nightaccess'] {
    --color-background: #052C56;
    --color-surface: #063568;
    --color-text-primary: #F9F2D4;
    --color-text-disabled: #A6B2CB;
    --color-interactive: #FA7571;
    --color-interactive-text: #112B53;
    --color-border: #ffffff;
    --color-brand: #E97D75;
    --color-border-rgba: rgba(166, 178, 203, 0.2);
    --bottom-nav-background: #03264c;
}

/* ------------------------- */
/* --- GENERAL STYLES ------ */
/* ------------------------- */
body {
    background-color: var(--color-background);
    font: var(--style-body);
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-y: auto;
}

body::-webkit-scrollbar {
    display: none;
}

/* Desktop view background image */
.desktop-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://images.unsplash.com/photo-1514320291840-2e0a9bf2a9ae?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    z-index: -1;
    display: none; /* Hidden by default on mobile */
}

.app-wrapper {
    width: 100%;
    max-width: 480px; /* Mobile view max width */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--color-background);
    position: relative;
}

@media (min-width: 768px) {
    .desktop-background {
        display: block;
    }
    .app-wrapper {
        /* Add a little shadow for better contrast */
        box-shadow: 0 0 30px rgba(0,0,0,0.5);
    }
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-top: 88px; /* Top bar height */
    padding-bottom: 90px; /* Bottom bar height */
}

/* Single view/page */
.view {
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}
.view.active {
    display: flex; /* Active view is displayed */
}

/* Content boxes */
.content-box {
    background-color: var(--color-surface);
    border-radius: 10px;
    padding: 1rem;
}

/* Text style classes */
.text-title { font: var(--style-title); color: var(--color-text-primary); }
.text-headline { font: var(--style-headline); color: var(--color-text-primary); }
.text-body { font: var(--style-body); color: var(--color-text-primary)!important; }
.text-button { font: var(--style-button); color: var(--color-interactive-text); }
.text-note { font: var(--style-note); color: var(--color-text-primary); }
.text-interactive { color: var(--color-interactive); }
.text-link { color: var(--color-interactive); text-decoration: underline; }

/* Buttons */
.btn-main {
    background-color: var(--color-interactive);
    color: var(--color-text-primary);
    font: var(--style-button);
    border-radius: 10px;
    border: none;
    padding: 0.75rem 1.5rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-main:hover {
    opacity: 0.9;
    color: var(--color-interactive-text);
}
a.btn-main {
    text-decoration: none;
}

/* Icons */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    font-size: 28px; /* Increased icon size */
    vertical-align: middle; /* Adjusted vertical alignment */
}
.icon-add { font-variation-settings: 'wght' 600 !important; }

/* ------------------------- */
/* --- COMPONENTS ---------- */
/* ------------------------- */

/* --- Toast Notifications --- */
.toast.toast-success {
    background-color: #A2D229;
    color: #000000;
    border: 1px solid #000000;
}
.toast.toast-error {
    background-color: #E2393B;
    color: #FFFFFF;
    border: 1px solid #FFFFFF;
}

/* Top menu */
#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    background-color: var(--color-background);
    z-index: 100;
}
#brand-logo {
    width: auto;
}
svn#brand-logo {
    height: 24px;
    color: var(--color-brand);
}
#back-button {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--color-surface);
    color: var(--color-interactive);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* Bottom menu */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px; /* Same as app-wrapper */
    margin: 0 auto;
    height: 80px;
    background-color: var(--bottom-nav-background);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--color-text-primary);
    font: var(--style-note);
    flex-grow: 1; /* Distributes space evenly */
}
.nav-item .material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 300;
}
.nav-item.active {
    color: var(--color-interactive);
}
.nav-item.active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 300;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font: var(--style-note);
    color: var(--color-text-disabled);
}
.form-control {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text-primary);
    padding: 0.75rem;
}
.form-control:focus {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    border-color: var(--color-interactive);
    box-shadow: none;
}
.form-control:disabled {
    background-color: var(--color-surface);
    color: var(--color-text-disabled);
    opacity: 0.7;
}

/* Sticky save button */
.sticky-save-button {
    position: fixed;
    bottom: 80px; /* Bottom bar height */
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    background-color: var(--color-background);
    z-index: 99;
}

/* Marketing permissions slider */
.form-switch .form-check-label {
    color: var(--color-text-primary);
}
.form-switch .form-check-input {
    width: 3em;
    height: 1.5em;
    background-color: var(--color-interactive); /* MODIFIED: Set to interactive color by default */
    border-color: var(--color-interactive);   /* MODIFIED: Set to interactive color by default */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:checked {
    background-color: var(--color-interactive);
    border-color: var(--color-interactive);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* List item with navigation */
.nav-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border-rgba);
    text-decoration: none;
    color: var(--color-text-primary);
}
.nav-list-item span {
    color: var(--color-text-primary);
}
.nav-list-item:last-child {
    border-bottom: none;
}
.nav-list-item .material-symbols-rounded {
    color: var(--color-interactive);
}

/* Accordion - Custom styles instead of Bootstrap */
.accordion {
    --bs-accordion-bg: transparent; /* Remove BS background */
}
.accordion-item {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--color-border-rgba);
}
.accordion-item:first-of-type, .accordion-item:last-of-type {
    border-radius: 0;
    border-bottom: 1px solid var(--color-border-rgba);
}
.accordion-item:last-of-type {
    border-bottom: none;
}
.accordion-button {
    font: var(--style-body);
    color: var(--color-text-primary);
    background-color: transparent;
    padding: 0.75rem 0;
}
.accordion-button:not(.collapsed) {
    color: var(--color-text-primary);
    background-color: transparent;
    box-shadow: none;
}
.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}
.accordion-body {
    padding: 1rem 0;
    font: var(--style-body);
    color: var(--color-text-primary);
}
.accordion-button::after {
    display: none;
}
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.accordion-icon {
    color: var(--color-interactive);
    transition: transform 0.2s ease-in-out;
}
.accordion-button:not(.collapsed) ~ .accordion-icon {
    transform: rotate(180deg);
}

/* Pass/Card element */
.pass-card {
    background-color: var(--color-surface);
    border-radius: 10px;
    overflow: hidden;
}
.pass-strip-image {
    height: 172px;
    background-image: url('https://placehold.co/600x160/445577/FFFFFF?text=Strip+Image');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pass-content {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pass-details {
    padding: 1rem;
    padding-top: 0;
}
.pass-qr {
    width: 60px;
    height: 60px;
    background-color: white;
    padding: 8px; /* Increased margin */
    border-radius: 8px; /* Increased radius to match margin */
    cursor: pointer;
}
.pass-qr img {
    width: 100%;
    height: 100%;
    display: block;
}

/*
 * FINAL FIX for Themeable Date Picker Icon
 *
 * Problem: 'currentColor' inside a background-image data URI inherits from the
 * parent element (<input>), not the pseudo-element (picker-indicator) itself.
 * The <input> has its color set to --color-text-primary, which we don't want.
 *
 * Solution: We create theme-specific rules that hardcode the correct
 * --color-interactive hex value directly into the SVG's 'fill' attribute.
 * This bypasses the inheritance issue entirely and guarantees the correct color.
 */

/* 1. Define common structural styles for the icon across all themes */
input[type="date"].form-control::-webkit-calendar-picker-indicator {
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
    cursor: pointer;
}

/* 2. Define the specific colored icon for EACH theme */

/* Light Theme: color is #1E9AC8 */
html[data-theme='light'] input[type="date"].form-control::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%231E9AC8' viewBox='0 0 16 16'%3E%3Cpath d='M8 7a.5.5 0 0 1 .5.5V9H10a.5.5 0 0 1 0 1H8.5v1.5a.5.5 0 0 1-1 0V10H6a.5.5 0 0 1 0-1h1.5V7.5A.5.5 0 0 1 8 7z'/%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
}

/* Dark Theme: color is #20C4F4 */
html[data-theme='dark'] input[type="date"].form-control::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2320C4F4' viewBox='0 0 16 16'%3E%3Cpath d='M8 7a.5.5 0 0 1 .5.5V9H10a.5.5 0 0 1 0 1H8.5v1.5a.5.5 0 0 1-1 0V10H6a.5.5 0 0 1 0-1h1.5V7.5A.5.5 0 0 1 8 7z'/%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
}

/* Nightaccess Theme: color is #FA7571 */
html[data-theme='nightaccess'] input[type="date"].form-control::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23FA7571' viewBox='0 0 16 16'%3E%3Cpath d='M8 7a.5.5 0 0 1 .5.5V9H10a.5.5 0 0 1 0 1H8.5v1.5a.5.5 0 0 1-1 0V10H6a.5.5 0 0 1 0-1h1.5V7.5A.5.5 0 0 1 8 7z'/%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
}

/*
 * Tom Select custom styles
 */
.ts-wrapper .ts-control {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border)!important;
    border-radius: 10px;
    padding: 0.5rem !important;
}
.ts-wrapper.focus .ts-control {
    background-color: var(--color-surface)!important;
    border-color: var(--color-border)!important;
    box-shadow: none;
}
/* This rule now only applies to multi-selects, not single-selects like on the support page. */
.ts-wrapper.multi .ts-control .item {
    color: var(--color-text-primary) !important;
    background-color: var(--color-interactive)!important;
}
.ts-wrapper .ts-control .item a {
    border: none!important;
}
.ts-wrapper .ts-control input::placeholder {
    color: var(--color-text-primary) !important;
}
.ts-wrapper.single .ts-control, .ts-wrapper.single .ts-control input {
    color: var(--color-text-primary);
}

.ts-dropdown {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.ts-dropdown .option {
    color: var(--color-text-primary);
    padding: 0.75rem;
}
.ts-dropdown .option.active {
    background-color: var(--color-background);
    color: var(--color-interactive);
}

/* HOME TAB COLOR CORRECTION */
#home-view .content-box .text-body {
    color: var(--color-text-primary) !important;
}
#home-view .content-box .material-symbols-rounded {
    color: var(--color-interactive) !important;
}

/* FIX: Add space below the form so the Save button doesn't cover content */
#profile-details-view .content-box {
    margin-bottom: 80px;
}
