:root {
    --primary-green: #67a93b;
    --sage-accent: #a7f3d0;
    --bg-dark: #0f172a;
    --gradient-eco: linear-gradient(135deg, #67a93b 0%, #059669 50%, #0284c7 100%);
    --gradient-bg: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
}

/* Reset e Layout Base */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    background-image: var(--gradient-bg);
    background-attachment: fixed;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

h1, h4, .brand-font {
    font-family: 'Montserrat', sans-serif;
}

/* Ambient Glow Effect */
.glow-orb {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 90vw);
    height: min(700px, 90vw);
    background: radial-gradient(circle, rgba(103, 169, 59, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

/* Glass Card Container */
.minimal-card {
    background: rgba(30, 41, 59, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 950px;
    width: 92%;
    margin: auto; /* Centra la card senza forzare margini che creano scroll */
    position: relative;
    z-index: 1;
}

/* Stili del Brand e del Logo */
.brand-logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: #ffffff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
}

.brand-logo .accent {
    color: var(--primary-green);
}

/* Immagine Logo Responsive */
.minimal-card img {
    max-width: 160px !important;
    height: auto;
    transition: transform 0.3s ease;
}

/* Dynamic Text Gradient */
.text-gradient {
    background: linear-gradient(135deg, #ffffff 30%, var(--sage-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: calc(1.25rem + 1.2vw);
}

/* Email Links Styling */
.contact-email {
    color: var(--sage-accent);
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
    padding: 2px 4px;
}

.contact-email:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

/* ==========================================================================
   MEDIA QUERIES (Desktop & Mobile Adaptations)
   ========================================================================== */

/* Su Mobile abilita lo scorrimento se lo schermo è piccolo */
@media (max-width: 767.98px) {
    body {
        overflow-y: auto;
    }
}

/* Su Desktop blocca lo scroll e adatta i padding per un'inquadratura perfetta */
@media (min-width: 768px) {
    body {
        overflow-y: hidden; /* Elimina la barra di scorrimento su desktop */
    }

    .minimal-card {
        padding: 2.5rem 3rem;
    }

    .brand-logo {
        font-size: 2.1rem;
    }

    .minimal-card img {
        max-width: 210px !important; /* Dimensione bilanciata per evitare lo scroll */
    }
}

.entra-button,
.site-button,
.site-button-quiet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

.entra-button,
.site-button {
    background: var(--primary-green);
    color: #ffffff;
}

.entra-button:hover,
.site-button:hover {
    color: #ffffff;
    background: #568f31;
}

.site-button-quiet {
    background: transparent;
    color: var(--sage-accent);
}

.site-field {
    width: 100%;
    margin-bottom: 0.9rem;
    text-align: left;
}

.site-field span,
.site-label {
    display: block;
    margin-bottom: 0.35rem;
    color: rgba(248, 250, 252, 0.72);
}

.site-field input,
.site-field select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(15, 23, 42, 0.55);
    color: #f8fafc;
    padding: 0.75rem 0.9rem;
}

.site-error {
    color: #fda4af;
    text-align: left;
}

.site-status {
    white-space: pre-line;
    text-align: left;
    color: var(--sage-accent);
}

body.employee,
body.employee-login {
    overflow-y: auto;
    height: auto;
    min-height: 100%;
}

html[data-theme="light"] {
    --app-bg: #e2e8f0;
    --app-fg: #0f172a;
    --app-card: #ffffff;
    --app-line: #94a3b8;
    --app-muted: #475569;
    --app-bar: #e2e8f0;
    --app-indicator: rgba(103, 169, 59, 0.45);
    --app-chip: rgba(103, 169, 59, 0.15);
    --app-chip-fg: #4e7f2e;
    --app-quiet: #4e7f2e;
    --app-field: #ffffff;
    --app-error: #be123c;
    --app-status: #4e7f2e;
}

html[data-theme="dark"] {
    --app-bg: #0f172a;
    --app-fg: #f8fafc;
    --app-card: #1e293b;
    --app-line: #475569;
    --app-muted: #cbd5e1;
    --app-bar: #0f172a;
    --app-indicator: rgba(103, 169, 59, 0.45);
    --app-chip: rgba(103, 169, 59, 0.22);
    --app-chip-fg: #c6e3a4;
    --app-quiet: #c6e3a4;
    --app-field: #1e293b;
    --app-error: #fda4af;
    --app-status: #c6e3a4;
}

body.employee {
    display: block;
    background: var(--app-bg);
    background-image: none;
    color: var(--app-fg);
    color-scheme: light;
}

html[data-theme="dark"] body.employee {
    color-scheme: dark;
}

body.employee-login .minimal-card {
    margin: 1.5rem auto;
    text-align: left;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: 72px;
    padding: 0 1rem;
    background: var(--app-bg);
    color: var(--app-fg);
    border-bottom: 3px solid var(--primary-green);
}

.app-mark {
    width: auto;
    height: 95%;
    object-fit: contain;
    border-radius: 0;
    border: solid 1px var(--app-line);
}

.app-main {
    width: min(720px, 100%);
    margin: 0 auto;
    padding: 0.5rem 1rem 6.5rem;
}

.app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: var(--app-bar);
    padding-bottom: env(safe-area-inset-bottom);
}

.app-tabbar-line {
    height: 2px;
    background: var(--primary-green);
}

.app-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.15rem 0.55rem;
    color: var(--app-fg);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.app-tabs a svg {
    display: block;
    width: 24px;
    height: 24px;
}

.app-tabs a .icon-on,
.app-tabs a.active .icon-idle {
    display: none;
}

.app-tabs a.active .icon-on {
    display: block;
}

.app-tabs a.active {
    color: var(--primary-green);
    font-weight: 700;
}

.tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 32px;
    border-radius: 16px;
}

.app-tabs a.active .tab-icon {
    background: var(--app-indicator);
}

body.employee a:not(.site-button):not(.entra-button):not(.nav-link) {
    color: inherit;
}

body.employee .site-button-quiet {
    color: var(--app-quiet);
}

body.employee .site-field span,
body.employee .site-label {
    color: var(--app-muted);
}

body.employee .site-field input,
body.employee .site-field select {
    background: var(--app-field);
    color: var(--app-fg);
    border-color: var(--app-line);
}

body.employee .site-error {
    color: var(--app-error);
}

body.employee .site-status {
    color: var(--app-status);
}

body.employee .trip-card,
body.employee .ticket-card {
    background: var(--app-card);
    border: 1px solid var(--app-line);
    border-radius: 24px;
}

body.employee .status-chip {
    background: var(--app-chip);
    color: var(--app-chip-fg);
}

.theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
    cursor: pointer;
}

.theme-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex: none;
}

.theme-switch input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.theme-track {
    display: block;
    width: 52px;
    height: 32px;
    border-radius: 16px;
    background: #cbd5e1;
}

.theme-track::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.15s ease;
}

.theme-switch input:checked + .theme-track {
    background: var(--primary-green);
}

.theme-switch input:checked + .theme-track::after {
    transform: translateX(20px);
}

.theme-switch input:focus-visible + .theme-track {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

body.employee-login .minimal-card img.login-mark {
    max-width: 210px !important;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.15rem;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1.25rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--primary-green);
}

.site-nav a {
    color: #f8fafc;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.site-nav a.active {
    background: rgba(103, 169, 59, 0.22);
    color: var(--sage-accent);
}

.month-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.month-grid > span,
.day-cell {
    text-align: center;
    min-height: 2rem;
}

.day-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
    line-height: 1;
    padding: 0.3rem 0.1rem;
}

.day-initial {
    min-height: 0;
    font-size: 0.7rem;
    line-height: 1;
}

.day-cell.today {
    box-shadow: inset 0 0 0 2px var(--primary-green);
}

.day-cell.selected,
.day-cell:has(input:checked) {
    background: var(--primary-green);
    color: #ffffff;
}

.day-cell:has(input:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--primary-green);
}

.day-cell:has(input:checked):has(input:focus-visible) {
    box-shadow: inset 0 0 0 2px #ffffff;
}

.day-cell.disabled {
    opacity: 0.35;
}

.day-cell.booked::after {
    content: "";
    width: 4px;
    height: 4px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--primary-green);
}

.day-cell.selected.booked::after,
.day-cell:has(input:checked).booked::after {
    background: #ffffff;
}

.trip-card,
.ticket-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem;
    margin-top: 1rem;
}

.trip-legs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.choice {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.ticket-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.ticket-chips {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.ticket-direction {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.board-dialog {
    width: min(26rem, calc(100vw - 2rem));
    border: 1px solid var(--app-line);
    border-radius: 24px;
    padding: 1rem;
    background: var(--app-card);
    color: var(--app-fg);
}

.board-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
}

.board-dialog video {
    width: 100%;
    max-height: 50vh;
    border-radius: 16px;
    background: #0f172a;
    object-fit: cover;
    margin-bottom: 0.75rem;
}

.status-chip {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    background: rgba(103, 169, 59, 0.15);
    color: var(--sage-accent);
    font-size: 0.8rem;
    font-weight: 600;
}

#bookingTab {
    border-bottom: 1px solid var(--app-line) !important;
}

#bookingTab .nav-link {
    color: var(--app-fg);
}

#bookingTab .nav-link:focus,
#bookingTab .nav-link:hover {
    /*isolation: isolate;*/
    border: solid 1px var(--app-line) !important;
}

#bookingTab .nav-link.active {
    color: #67a93b;
    font-weight: bold;
    border: solid 1px var(--app-line) !important;
    border-bottom-color: var(--app-bg) !important;
    background-color: transparent !important;
}


#bookingTabContent {border: solid 1px var(--app-line); border-top:none; padding:5px; margin-top:0px !important;}

