/* Brand Identity is loaded via <link> tag in register.php */

:root {
    /* Brand colors with transparency variations */
    --color-primary: var(--brand-white);
    --color-accent: var(--brand-petrolium);
    --color-bg: var(--brand-black);
    --color-card: rgba(255, 255, 255, 0.05); /* White with very low transparency for cards */
    --color-border: rgba(14, 67, 71, 0.4); /* Petrolium with transparency */
    --color-muted: rgba(255, 255, 255, 0.7); /* White with transparency */
    --color-success: var(--brand-petrolium);
    --color-error: var(--brand-petrolium);
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(14, 67, 71, 0.2); /* Layered shadows */
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(14, 67, 71, 0.15);
    --shadow-focus: 0 0 0 3px rgba(14, 67, 71, 0.3), 0 4px 12px rgba(14, 67, 71, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent white bleed outside container - html/body must cover full viewport */
html {
    background: var(--brand-black);
}
body {
    font-family: var(--font-primary); /* Use primary font (Helvetica Neue Condensed) */
    background: var(--brand-black);
    color: var(--brand-white);
    line-height: var(--line-height-normal);
    padding: 0;
    margin: 0;
    min-height: 100vh;
    letter-spacing: var(--letter-spacing-primary); /* Normal spacing for primary font */
}

/* ============================================
   HEADER - Fixed Height, Stable on Zoom
   ============================================ */
header {
    background: var(--brand-white) !important;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(14, 67, 71, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    height: 80px;
    min-height: 80px;
    max-height: 80px;
}

header .logo-link {
    display: flex;
    align-items: stretch;
    z-index: 10;
    height: 100%;
    flex-shrink: 0;
    line-height: 0;
    margin: 0;
    padding: 0;
}

header .logo-link.logo-header {
    height: 100%;
    display: flex;
    align-items: stretch;
    overflow: visible;
    margin: 0;
    padding: 0;
}

header .logo-link.logo-header img {
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: contain;
    object-position: left center;
    display: block;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    text-align: center;
    flex: 1;
    margin: 0;
}

header .lang-switcher-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ============================================
   LANGUAGE SWITCHER (Moved from PHP inline styles)
   ============================================ */
.language-switcher {
    --lang-dropdown-gap: 0.25rem;
    position: relative;
    display: inline-block;
    z-index: 1000;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: clamp(0.375rem, 1vw, 0.5rem);
    padding: clamp(0.375rem, 1.5vw, 0.5rem) clamp(0.5rem, 2vw, 0.75rem);
    background: rgba(14, 67, 71, 0.1); /* Petrolium with transparency */
    border: 1px solid rgba(14, 67, 71, 0.3); /* Petrolium border with transparency */
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--brand-black);
}

.lang-current:hover {
    background: rgba(14, 67, 71, 0.15); /* Slightly more opaque on hover */
    border-color: rgba(14, 67, 71, 0.5);
    box-shadow: 0 2px 8px rgba(14, 67, 71, 0.2);
}

.lang-flag {
    width: clamp(1.25rem, 3vw, 1.5rem);
    height: clamp(0.9375rem, 2.25vw, 1.125rem);
    border-radius: 0.125rem;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(14, 67, 71, 0.2); /* Petrolium shadow with transparency */
}

.lang-dropdown-bridge {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: var(--lang-dropdown-gap);
    pointer-events: auto;
}

.language-switcher:hover .lang-dropdown-bridge {
    display: block;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + var(--lang-dropdown-gap));
    right: 0;
    background: rgba(255, 255, 255, 0.95); /* White with slight transparency */
    border: 1px solid rgba(14, 67, 71, 0.3); /* Petrolium border with transparency */
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(14, 67, 71, 0.2);
    min-width: clamp(9.375rem, 25vw, 11.25rem);
    overflow: hidden;
}

.language-switcher:hover .lang-dropdown {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 0.625rem);
    padding: clamp(0.5rem, 1.5vw, 0.625rem) clamp(0.75rem, 2vw, 0.875rem);
    text-decoration: none;
    color: var(--brand-black);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(14, 67, 71, 0.2); /* Petrolium border with transparency */
}

.lang-option:last-child {
    border-bottom: none;
}

.lang-option:hover {
    background: rgba(14, 67, 71, 0.1); /* Petrolium with transparency */
}

.lang-option.active {
    background: rgba(14, 67, 71, 0.15); /* Petrolium with more transparency */
    font-weight: 600;
}

.lang-arrow {
    margin-left: 0.25rem;
    font-size: clamp(0.625rem, 1.5vw, 0.7rem);
    opacity: 0.6;
}

/* ============================================
   CONTAINER - Optimized for All Screen Sizes
   ============================================ */
.container {
    max-width: min(100%, 50rem); /* Narrower for better form readability */
    margin: clamp(1.5rem, 5vw, 3rem) auto clamp(2.5rem, 6vw, 3.75rem);
    background: transparent;
    padding: clamp(1.5rem, 5vw, 3rem);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(14, 67, 71, 0.3);
}

/* ============================================
   TYPOGRAPHY - Responsive Scaling
   ============================================ */
h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 4vw, 1.75rem);
    font-weight: var(--font-weight-semibold);
    color: var(--brand-white);
    margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem);
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--brand-white);
    opacity: 0.8;
    font-size: clamp(0.875rem, 2.5vw, 0.95rem);
    font-family: var(--font-primary) !important; /* Use primary font for subtitles */
    letter-spacing: -0.02em;
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
}

label {
    display: block;
    margin-top: clamp(0.875rem, 2.5vw, 1.125rem);
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    font-family: var(--font-primary); /* Use primary font for labels */
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--brand-white);
    opacity: 0.8;
}

label .required,
.note .required {
    color: #FF0000; /* Red for required fields - only exception to brand colors */
    margin-left: 0.125rem;
}

/* ============================================
   FORM ROWS - Nome+Cognome, Sesso+Data di nascita
   ============================================ */
.form-row {
    display: flex;
    gap: clamp(0.875rem, 2.5vw, 1rem);
    align-items: flex-start;
}

.flex-small {
    flex: 0 0 6.25rem;
}

.flex-grow {
    flex: 1;
}

/* ============================================
   PHONE ROW - Prefix + number on same line
   ============================================ */
.phone-row {
    display: flex;
    gap: clamp(0.5rem, 1.5vw, 0.625rem);
    align-items: flex-start;
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
}

.phone-row #telefono_prefisso {
    width: 6.875rem;
    flex-shrink: 0;
}

.phone-row .prefix-custom-input {
    width: 5rem;
    flex-shrink: 0;
}

.phone-row .phone-input-flex {
    flex: 1;
    min-width: 0;
}

.phone-row input,
.phone-row select {
    margin-top: 0;
}

/* ============================================
   FORM INPUTS
   ============================================ */
input, select {
    width: 100%;
    padding: clamp(0.5rem, 1.5vw, 0.625rem) clamp(0.625rem, 1.5vw, 0.75rem);
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
    border: 1px solid rgba(14, 67, 71, 0.5);
    border-radius: 0.625rem;
    font-size: clamp(0.9375rem, 2.5vw, 1rem);
    font-family: var(--font-primary); /* Use primary font for inputs */
    transition: border 0.2s, box-shadow 0.2s, background 0.2s;
    background: var(--brand-petrolium); /* Solid brand petroleum */
    color: var(--brand-white);
    box-shadow: var(--shadow-soft);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--brand-petrolium);
    background: var(--brand-petrolium);
    box-shadow: var(--shadow-focus);
}

input.invalid,
select.invalid {
    border-color: var(--brand-petrolium);
    background-color: var(--brand-petrolium);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), var(--shadow-soft);
}

input.invalid:focus,
select.invalid:focus {
    border-color: var(--brand-petrolium);
    box-shadow: var(--shadow-focus);
}

input:disabled {
    background: rgba(14, 67, 71, 0.4); /* Dimmed petroleum */
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   BIRTH DATE ROW - Responsive Grid
   ============================================ */
.birth-date-row {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: clamp(0.5rem, 1.5vw, 0.625rem);
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
}

.birth-date-row select {
    margin-top: 0;
}

.help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: clamp(0.8125rem, 2vw, 0.85rem);
    color: var(--brand-white);
    opacity: 0.7;
    font-style: italic;
}

/* ============================================
   PRIVACY BOX
   ============================================ */
.privacy-box {
    background: rgba(14, 67, 71, 0.15); /* Petrolium with transparency */
    border: 1px solid rgba(14, 67, 71, 0.4);
    border-radius: 0.625rem;
    padding: clamp(1rem, 3vw, 1.25rem);
    margin-top: clamp(1rem, 3vw, 1.5rem);
    box-shadow: var(--shadow-soft);
}

.privacy-box strong {
    display: block;
    margin-bottom: clamp(0.75rem, 2vw, 0.875rem);
    font-size: clamp(0.8125rem, 2.5vw, 0.9rem);
    color: var(--brand-white);
}

.privacy-checkbox {
    display: flex;
    align-items: flex-start;
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
}

.privacy-checkbox input[type="checkbox"] {
    width: auto;
    margin: clamp(0.25rem, 0.75vw, 0.375rem) clamp(0.5rem, 1.5vw, 0.625rem) 0 0;
    cursor: pointer;
}

.privacy-checkbox label {
    margin: 0;
    font-size: clamp(0.8125rem, 2.5vw, 0.9rem);
    font-family: var(--font-primary); /* Use primary font for privacy labels */
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--brand-white);
    cursor: pointer;
}

/* Consenso Marketing: checkbox + label on left, arrow on right */
.marketing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
    margin-bottom: 0;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 0.625rem);
    font-size: clamp(0.8125rem, 2.5vw, 0.9rem);
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    font-weight: 600;
    cursor: pointer;
    text-transform: none;
}

.arrow-trigger {
    cursor: pointer;
    padding: clamp(0.25rem, 0.75vw, 0.375rem) clamp(0.5rem, 1.5vw, 0.625rem);
    font-size: clamp(0.6875rem, 1.75vw, 0.75rem);
    color: var(--brand-petrolium);
    transition: transform 0.3s ease;
    user-select: none;
}

.arrow-trigger:hover {
    color: var(--brand-white);
}

.arrow-trigger.active {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: clamp(1.25rem, 3vw, 1.5rem);
    border-left: 2px solid rgba(14, 67, 71, 0.4);
    margin-left: 0.4375rem;
}

.accordion-content .privacy-checkbox {
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
}

.accordion-content .privacy-checkbox:first-child {
    margin-top: clamp(0.375rem, 1vw, 0.5rem);
}

.privacy-link {
    color: var(--brand-white);
    text-decoration: underline;
    font-weight: var(--font-weight-medium);
}

.privacy-link:hover,
.privacy-link:focus-visible {
    opacity: 0.9;
}

/* ============================================
   BUTTON
   ============================================ */
button {
    margin-top: clamp(1.25rem, 3.5vw, 1.75rem);
    width: 100%;
    padding: clamp(0.875rem, 2.5vw, 1rem);
    background: var(--brand-petrolium);
    color: var(--brand-white);
    border: none;
    border-radius: 0.625rem;
    font-size: clamp(0.9375rem, 2.5vw, 1rem);
    font-family: var(--font-heading); /* Use brand heading font */
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(14, 67, 71, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    background: rgba(14, 67, 71, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 67, 71, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

button:disabled {
    background: rgba(14, 67, 71, 0.4);
    cursor: not-allowed;
    box-shadow: var(--shadow-soft);
    opacity: 0.6;
}

/* Landing page CTA (button-style link) */
.landing-cta-wrapper {
    margin-top: clamp(1.25rem, 3.5vw, 1.75rem);
    text-align: center;
}

.landing-cta {
    display: inline-block;
    padding: clamp(0.875rem, 2.5vw, 1rem) clamp(1.5rem, 4vw, 2rem);
    background: var(--brand-petrolium);
    color: var(--brand-white);
    border: none;
    border-radius: 0.625rem;
    font-size: clamp(0.9375rem, 2.5vw, 1rem);
    font-family: var(--font-heading);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.5px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(14, 67, 71, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.landing-cta:hover {
    background: rgba(14, 67, 71, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 67, 71, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.note {
    font-size: clamp(0.8125rem, 2vw, 0.85rem);
    font-family: var(--font-primary); /* Use primary font for notes */
    color: var(--brand-white);
    opacity: 0.7;
    margin-top: clamp(0.875rem, 2.5vw, 1rem);
    text-align: center;
}

.note p {
    margin: 0 0 0.5rem 0;
}

.note p:last-child {
    margin-bottom: 0;
}

/* ============================================
   SPINNER
   ============================================ */
.spinner {
    display: inline-block;
    width: clamp(1rem, 2.5vw, 1.125rem);
    height: clamp(1rem, 2.5vw, 1.125rem);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--brand-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: clamp(0.375rem, 1vw, 0.5rem);
    vertical-align: middle;
}

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

/* ============================================
   FEEDBACK MESSAGES
   ============================================ */
.feedback {
    padding: clamp(0.875rem, 2.5vw, 1rem) clamp(1rem, 3vw, 1.25rem);
    border-radius: 0.625rem;
    font-size: clamp(0.875rem, 2.5vw, 0.95rem);
    margin-bottom: clamp(1rem, 3vw, 1.25rem);
    white-space: pre-line;
    line-height: 1.45;
    display: none;
}

.feedback.show {
    display: block;
}

.feedback.success {
    background: rgba(14, 67, 71, 0.2);
    color: var(--brand-white);
    border: 1px solid rgba(14, 67, 71, 0.5);
    box-shadow: var(--shadow-soft);
}

.feedback.error {
    background: rgba(14, 67, 71, 0.25);
    color: var(--brand-white);
    border: 1px solid rgba(14, 67, 71, 0.6);
    box-shadow: var(--shadow-soft);
}

/* ============================================
   SUCCESS PANEL (Used by registration_success.php, NOT register.php)
   ============================================ */
#successPanel {
    opacity: 1;
    visibility: visible;
    /* No animation to prevent CLS - content is immediately visible */
    /* Space is reserved, preventing layout shift */
}

#successPanel.show {
    opacity: 1;
    visibility: visible;
}

/* Animation removed to prevent CLS violation */
/* If animation is needed in future, use opacity/visibility with reserved space */

.success-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

.success-header h3 {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: var(--font-weight-semibold);
    color: var(--brand-white);
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
}

.success-header p {
    color: var(--brand-white);
    opacity: 0.8;
    font-size: clamp(0.875rem, 2.5vw, 0.95rem);
    line-height: 1.6;
}

.success-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: clamp(1rem, 3vw, 1.5rem);
    padding: 0.75rem 1.5rem;
    min-height: 2.75rem;
    font-family: var(--font-heading);
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

/* ============================================
   GIFT CARDS SECTION (Used by registration_success.php, NOT register.php)
   ============================================ */
.gifts-section {
    margin: clamp(1.5rem, 4vw, 2rem) 0;
}

.gifts-title {
    text-align: center;
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: var(--brand-white);
    margin-bottom: clamp(1rem, 3vw, 1.25rem);
    font-weight: 600;
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
    max-width: 43.75rem;
    margin: 0 auto;
}

/* Hide empty gift grids (e.g., on success page without items) */
.gift-grid:empty {
    display: none;
}

.gift-card {
    background: rgba(14, 67, 71, 0.2);
    border: 2px solid rgba(14, 67, 71, 0.4);
    border-radius: 0.625rem;
    padding: clamp(0.5rem, 1.5vw, 0.75rem);
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.375rem, 1vw, 0.5rem);
    box-shadow: var(--shadow-soft);
}

.gift-card:hover {
    border-color: var(--brand-petrolium);
    background: rgba(14, 67, 71, 0.3);
    box-shadow: 0 8px 24px rgba(14, 67, 71, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.gift-logo {
    height: clamp(1.75rem, 4vw, 2rem);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.gift-divider {
    width: 80%;
    height: 1px;
    background: rgba(14, 67, 71, 0.2); /* Petrolium with transparency */
    margin: clamp(0.25rem, 0.75vw, 0.375rem) 0;
}

.gift-image {
    width: clamp(2.75rem, 6vw, 3.125rem);
    height: clamp(2.75rem, 6vw, 3.125rem);
    object-fit: contain;
    margin: clamp(0.25rem, 0.75vw, 0.375rem) 0;
}

.gift-text {
    color: var(--brand-white);
    font-weight: 600;
    font-size: clamp(0.6875rem, 1.75vw, 0.75rem);
    margin: 0;
    line-height: 1.2;
}

.qr-instruction {
    margin-top: clamp(1rem, 3vw, 1.5rem);
    padding: clamp(0.875rem, 2.5vw, 1rem);
    background: rgba(14, 67, 71, 0.15);
    border-left: 4px solid var(--brand-petrolium);
    border-radius: 0.375rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
}

.qr-instruction p {
    color: var(--brand-white);
    font-size: clamp(0.875rem, 2.5vw, 0.95rem);
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
}

.welcome-link {
    margin-top: clamp(1.5rem, 4vw, 2rem);
    text-align: center;
}

.welcome-link a {
    display: inline-block;
    padding: clamp(0.75rem, 2vw, 0.875rem) clamp(1rem, 3vw, 1.5rem);
    background: var(--brand-petrolium);
    color: var(--brand-white);
    text-decoration: none;
    border-radius: 0.625rem;
    font-family: var(--font-heading); /* Use brand heading font */
    font-weight: var(--font-weight-semibold);
    font-size: clamp(0.875rem, 2.5vw, 0.95rem);
    box-shadow: 0 4px 16px rgba(14, 67, 71, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.welcome-link a:hover {
    background: rgba(14, 67, 71, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 67, 71, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: clamp(1.5rem, 4vw, 2rem) clamp(0.875rem, 2.5vw, 1rem);
    font-size: clamp(0.6875rem, 1.75vw, 0.75rem);
    font-family: var(--font-primary); /* Use primary font for footer */
    color: var(--brand-white);
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Small screen / phone (max 767px) - full width; desktop (768px+) unchanged */
@media (max-width: 767px) {
    .container {
        width: 100%;
        max-width: 100%;
        margin: 1rem 0.5rem 2rem;
        padding: 1rem 0.5rem;
    }
}

/* Mobile Portrait Form (max 480px) - stacked layout, smaller prefix, iOS-friendly */
@media (max-width: 480px) {
    /* Form rows: stack Sex + Date of Birth for clean mobile layout */
    .form-row {
        flex-direction: column;
        gap: 0.875rem;
    }

    /* Nome+Cognome stay on same row even in portrait */
    .form-row-name {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .form-row .flex-small,
    .form-row .flex-grow {
        width: 100%;
        min-width: 0;
        flex: none;
    }

    .form-row-name .flex-grow {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
    }

    .form-row-name .flex-small {
        width: auto;
        flex: 0 0 4rem;
        min-width: 0;
    }

    /* Birth-date grid: min width for dd/mm visibility, smaller year column */
    .birth-date-row {
        grid-template-columns: minmax(2.5rem, 1fr) minmax(2.5rem, 1fr) minmax(0, 1.2fr);
        gap: 0.5rem;
    }

    /* Smaller phone prefix on mobile (~68px) */
    .phone-row #telefono_prefisso {
        width: 4.25rem;
        max-width: 4.25rem;
    }

    .phone-row .prefix-custom-input {
        width: 4rem;
        max-width: 4rem;
    }

    /* Input font ≥16px to prevent iOS zoom on focus */
    .container input,
    .container select {
        font-size: 1rem;
    }

    /* Safe area insets for notched devices */
    .container {
        padding-left: calc(1rem + env(safe-area-inset-left, 0px));
        padding-right: calc(1rem + env(safe-area-inset-right, 0px));
    }

    /* Touch target ≥44px for accordion arrow */
    .arrow-trigger {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Privacy checkbox: single row, compact text */
    .privacy-checkbox {
        flex-wrap: nowrap;
        align-items: center;
    }

    .privacy-checkbox label {
        font-size: clamp(0.75rem, 2vw, 0.85rem);
        white-space: nowrap;
    }
}

/* Mobile Small (320px - 360px) - full width, minimal gutter; form layout inherits from 480px */
@media (max-width: 360px) {
    .container {
        width: 100%;
        max-width: 100%;
        margin: 0.75rem 0.5rem 1.5rem;
        padding: 0.875rem calc(0.5rem + env(safe-area-inset-right, 0px)) 0.875rem calc(0.5rem + env(safe-area-inset-left, 0px));
    }
    
    /* Header: same row as horizontal (logo left, lang switcher right) */
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: 60px;
        min-height: 60px;
        max-height: 60px;
        padding: 0 0.5rem;
    }
    
    header .logo-link.logo-header img {
        height: 100% !important;
    }
    
    header .lang-switcher-wrapper {
        padding-right: 0;
    }
    
    .page-validator header {
        justify-content: flex-start;
        padding: 0 0.5rem;
    }
}

/* Mobile Large (361px - 430px) - header tweaks; form layout inherits from 480px */
@media (min-width: 361px) and (max-width: 430px) {
    .container {
        width: 100%;
        max-width: 100%;
        margin: 1rem 0.5rem 2rem;
        padding: 1rem calc(0.5rem + env(safe-area-inset-right, 0px)) 1rem calc(0.5rem + env(safe-area-inset-left, 0px));
    }
    
    header {
        height: 65px;
        min-height: 65px;
        max-height: 65px;
    }
    
    header .logo-link.logo-header img {
        height: 100%;
    }
    
    header .lang-switcher-wrapper {
        padding-right: 1rem;
    }
    
    .page-validator header {
        justify-content: flex-start;
        padding: 0 1rem;
    }
}

/* Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        max-width: min(100%, 45rem);
        padding: clamp(1.5rem, 4vw, 2rem);
    }
    
    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet Landscape (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .container {
        max-width: min(100%, 50rem);
    }
    
    .gift-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Laptop (1280px - 1439px) */
@media (min-width: 1280px) and (max-width: 1439px) {
    .container {
        max-width: min(100%, 50rem);
    }
}

/* Desktop (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
    header {
        height: 100px;
        min-height: 100px;
        max-height: 100px;
    }
    
    header .logo-link.logo-header img {
        height: 100%;
    }
    
    header .lang-switcher-wrapper {
        padding-right: 1.5rem;
    }
    
    .container {
        max-width: min(100%, 50rem);
    }
}

/* Ultra-wide (1920px+) */
@media (min-width: 1920px) {
    header {
        height: 100px;
        min-height: 100px;
        max-height: 100px;
    }
    
    header .logo-link.logo-header img {
        height: 100%;
    }
    
    header .lang-switcher-wrapper {
        padding-right: 1.5rem;
    }
    
    .container {
        max-width: min(100%, 50rem);
    }
}

/* ============================================
   ORIENTATION HANDLING
   ============================================ */

/* Portrait Orientation */
@media (orientation: portrait) {
    header {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }
    
    header .logo-link.logo-header img {
        height: 100%;
    }
    
    .page-validator header {
        justify-content: flex-start;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 600px) {
    header {
        height: 60px;
        min-height: 60px;
        max-height: 60px;
    }
    
    header .logo-link.logo-header img {
        height: 100%;
    }
    
    header .lang-switcher-wrapper {
        padding-right: 1rem;
    }
}

/* ============================================
   PHONE / SMALL SCREEN (max 680px) - Full width
   ============================================ */
@media (max-width: 680px) {
    .container {
        width: 100%;
        max-width: 100%;
        margin: 1rem 0.5rem 2rem;
        padding: 1rem 0.5rem;
    }
    
    header {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }
    
    header .logo-link.logo-header img {
        height: 100%;
    }
    
    header .lang-switcher-wrapper {
        padding-right: 1rem;
    }
    
    .page-validator header {
        justify-content: flex-start;
        padding: 0 1rem;
    }
    
    /* Smaller phone prefix on mobile (481px-680px; 320-480px from 480px block) */
    .phone-row #telefono_prefisso {
        width: 4.25rem;
        max-width: 4.25rem;
    }

    .phone-row .prefix-custom-input {
        width: 4rem;
        max-width: 4rem;
    }

    /* Input font ≥16px to prevent iOS zoom on focus (481-680px) */
    .container input,
    .container select {
        font-size: 1rem;
    }
    
    /* Gift cards mobile (for registration_success.php) */
    .gift-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Touch target ≥44px for accordion arrow (all phones, portrait and landscape) */
    .arrow-trigger {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Portrait phone only: center register modal with equal left/right spacing (fix asymmetric padding) */
@media (max-width: 767px) and (orientation: portrait) {
    .container {
        width: calc(100% - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        max-width: calc(100% - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        margin-top: 1rem;
        margin-bottom: 2rem;
        margin-left: calc(1rem + env(safe-area-inset-left, 0px));
        margin-right: calc(1rem + env(safe-area-inset-right, 0px));
        padding: 1rem calc(1rem + env(safe-area-inset-right, 0px)) 1rem calc(1rem + env(safe-area-inset-left, 0px));
    }
}

/* Portrait phone (max 430px): zero horizontal padding for map pages to maximize narrow space */
@media (max-width: 430px) and (orientation: portrait) {
    .page-landing .container,
    .page-registration-success .container {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }
}

/* ============================================
   INPUT STYLING ENHANCEMENTS
   ============================================ */

/* Force dark inputs while typing and on autofill */
input, select, textarea {
    caret-color: var(--brand-white);
}

input:focus, select:focus, textarea:focus {
    background: var(--brand-petrolium);
    color: var(--brand-white);
    caret-color: var(--brand-white);
}

/* Override Chrome/Edge autofill light background - scoped and hex for reliability */
.container input:-webkit-autofill,
.container select:-webkit-autofill,
.container textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0E4347 inset !important;
    box-shadow: 0 0 0 1000px #0E4347 inset !important;
    -webkit-text-fill-color: #FFFFFF !important;
    color: #FFFFFF;
    caret-color: #FFFFFF;
    background-color: #0E4347;
    border: 1px solid rgba(14, 67, 71, 0.5);
    transition: background-color 5000s ease-in-out 0s;
}

.container input:-webkit-autofill:focus,
.container select:-webkit-autofill:focus,
.container textarea:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0E4347 inset, var(--shadow-focus) !important;
    box-shadow: 0 0 0 1000px #0E4347 inset, var(--shadow-focus) !important;
    -webkit-text-fill-color: #FFFFFF !important;
    color: #FFFFFF;
}

/* Firefox: keep dark background and white text on autofill */
.container input:-moz-autofill,
.container input:-moz-autofill-preview,
.container select:-moz-autofill,
.container select:-moz-autofill-preview,
.container textarea:-moz-autofill,
.container textarea:-moz-autofill-preview {
    background-color: #0E4347 !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(14, 67, 71, 0.5);
}

/* ============================================
   CUSTOM PREFIX INPUT - Show/Hide Logic
   ============================================ */
.prefix-custom-input {
    display: none !important;
    margin-top: clamp(0.25rem, 1vw, 0.375rem);
}

/* Show custom input when "custom" option is selected - handled by JS */
.prefix-custom-visible .prefix-custom-input {
    display: block !important;
}

/* ============================================
   SUPPORT PAGE (040group.com/support)
   Same layout as landing; brand card panel, mailto link
   ============================================ */
.page-support .support-panel {
    max-width: min(100%, 36rem);
    margin: 0 auto clamp(1.5rem, 4vw, 2.5rem);
    padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 1.75rem);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-card);
    text-align: center;
}

.page-support .support-label {
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    margin: 1.25rem 0 0.375rem;
}

.page-support .support-label:first-of-type {
    margin-top: 0;
}

.page-support .support-value {
    font-family: var(--font-primary);
    font-size: clamp(0.9375rem, 2vw, 1rem);
    color: var(--brand-white);
    line-height: 1.5;
    margin: 0;
}

.page-support .support-value--strong {
    font-weight: var(--font-weight-semibold);
}

.page-support .support-value--address {
    margin-top: 0.5rem;
    opacity: 0.95;
}

.page-support .support-value a {
    color: var(--brand-white);
    font-weight: var(--font-weight-semibold);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.page-support .support-value a:hover {
    text-decoration-thickness: 2px;
}

.page-support .support-value a:focus-visible {
    outline: 2px solid var(--brand-petrolium);
    outline-offset: 3px;
    border-radius: 2px;
}
