/* ==========================================================================
   Shared Design Tokens, Resets & Component Styles
   Used across all pages: landing, RSVP, menu, itinerario.
   ========================================================================== */

/* Design Tokens & Theme Variable Definitions */
:root {
    --bg-color: #f2ede7; /* Warm beige background from color_style.jpg */
    --card-bg: #ffffff;
    --text-primary: #3d3122; /* Deep warm brown/charcoal for premium look */
    --text-secondary: #6e5e4d; /* Muted bronze-brown */
    --text-light: #9e8e7c; /* Light warm brown */
    --accent-sage: #735121; /* Rich bronze-gold from invitation calligraphy */
    --accent-sage-dark: #583c15; /* Deeper bronze for hover states */
    --accent-sage-light: #fbf9f6; /* Very soft warm tint */
    --border-color: #dfd8cf; /* Soft warm border */
    --error-color: #a93226; /* Elegant red */
    --shadow-sm: 0 2px 4px rgba(61, 49, 34, 0.04);
    --shadow-md: 0 10px 30px rgba(61, 49, 34, 0.06);
    --font-script: 'Alex Brush', cursive;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Cormorant Garamond', Georgia, serif;
    --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Typography and Element Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top, #fcfaf7 0%, var(--bg-color) 100%);
    font-family: var(--font-sans);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 10px;
    line-height: 1.5;
}

/* ==========================================================================
   Card Container Design
   ========================================================================== */
.rsvp-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(122, 154, 134, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ==========================================================================
   Typography Styles
   ========================================================================== */
h1.rsvp-title {
    font-family: var(--font-script);
    font-size: 3.8rem;
    color: var(--accent-sage);
    font-weight: 400;
    margin-bottom: 2px;
    text-align: center;
    line-height: 1.1;
}

.rsvp-invitation-text {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-align: center;
}

.rsvp-guest-name {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    color: var(--accent-sage);
    font-weight: 600;
    margin-bottom: 36px;
    text-align: center;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: -6px;
    margin-bottom: 18px;
    line-height: 1.5;
}

.section-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 32px 0;
    border: none;
}

/* ==========================================================================
   Progressive State Form Sections
   ========================================================================== */
.form-section {
    max-height: 0;
    opacity: 0;
    transform: translateY(15px);
    overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.5s ease, 
                transform 0.5s ease,
                margin-bottom 0.5s ease;
    margin-bottom: 0;
    pointer-events: none;
}

.form-section.visible {
    max-height: 2500px;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 32px;
    pointer-events: auto;
}

/* ==========================================================================
   Card Section Wrapper
   ========================================================================== */
.section-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    background-color: #FCFDFD;
    transition: var(--transition-smooth);
}

.section-card.error-highlight {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(208, 0, 0, 0.08);
    animation: shake 0.4s ease-in-out;
}

/* ==========================================================================
   Custom Interactive Controls (Radio & Checkbox Buttons)
   ========================================================================== */
.interactive-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-radio, .custom-checkbox {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    background-color: var(--card-bg);
    user-select: none;
}

.custom-radio:hover, .custom-checkbox:hover:not(.disabled) {
    border-color: var(--accent-sage);
    background-color: rgba(122, 154, 134, 0.02);
    transform: translateY(-1px);
}

.custom-radio input[type="radio"], 
.custom-checkbox input[type="checkbox"] {
    display: none;
}

/* Custom Radio Circle Icon */
.radio-dot {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    background-color: var(--card-bg);
}

.custom-radio input[type="radio"]:checked + .radio-dot {
    border-color: var(--accent-sage);
}

.custom-radio input[type="radio"]:checked + .radio-dot::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--accent-sage);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Custom Checkbox Box Icon */
.checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    position: relative;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    background-color: var(--card-bg);
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-box {
    border-color: var(--accent-sage);
    background-color: var(--accent-sage);
}

.custom-checkbox input[type="checkbox"]:checked + .checkbox-box::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 10px;
    border: solid #FFFFFF;
    border-width: 0 2px 2px 0;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Selected State Styling */
.custom-radio.selected, .custom-checkbox.selected {
    border-color: var(--accent-sage);
    background-color: var(--accent-sage-light);
}

/* Disabled State Styling */
.custom-checkbox.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border-color);
    background-color: #F8FAF9;
}

.custom-label-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 500;
}

.custom-radio.selected .custom-label-text,
.custom-checkbox.selected .custom-label-text {
    font-weight: 600;
}

/* ==========================================================================
   Count Grid (Step 3)
   ========================================================================== */
.count-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.count-btn {
    flex: 1;
    min-width: 60px;
    height: 54px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    background-color: var(--card-bg);
    user-select: none;
}

.count-btn:hover {
    border-color: var(--accent-sage);
    background-color: rgba(122, 154, 134, 0.02);
    transform: translateY(-1px);
}

.count-btn input[type="radio"] {
    display: none;
}

.count-btn.selected {
    border-color: var(--accent-sage);
    background-color: var(--accent-sage-light);
    color: var(--accent-sage-dark);
}

/* ==========================================================================
   Dynamic Dietary Grid Table Layout (Step 5)
   ========================================================================== */
.dietary-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
}

.dietary-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.dietary-thead {
    background-color: #F8FAF9;
    border-bottom: 1.5px solid var(--border-color);
}

.dietary-th {
    padding: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dietary-th:not(:first-child) {
    text-align: center;
}

.dietary-tr {
    border-bottom: 1.5px solid var(--border-color);
    transition: background-color 0.25s ease;
}

.dietary-tr:last-child {
    border-bottom: none;
}

.dietary-td {
    padding: 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.dietary-td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    width: 32%;
}

.dietary-td:not(:first-child) {
    text-align: center;
}

/* Table cell radio layout */
.table-radio-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 8px 0;
    user-select: none;
}

.table-radio-label input[type="radio"] {
    display: none;
}

.table-radio-circle {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: var(--transition-smooth);
    background-color: var(--card-bg);
}

.table-radio-label input[type="radio"]:checked + .table-radio-circle {
    border-color: var(--accent-sage);
}

.table-radio-label input[type="radio"]:checked + .table-radio-circle::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--accent-sage);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.table-radio-text {
    display: none; /* Hidden on desktop */
}

/* Row styling when "Otro" input is displayed */
.other-row {
    background-color: #FDFEFE;
    border-bottom: 1.5px solid var(--border-color);
}

.other-row.hidden {
    display: none;
}

.other-input-wrapper {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: slideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    overflow: hidden;
}

.other-input-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-sage-dark);
}

.other-text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
    background-color: var(--card-bg);
}

.other-text-input:focus {
    outline: none;
    border-color: var(--accent-sage);
    box-shadow: 0 0 0 3px rgba(122, 154, 134, 0.12);
}

/* Responsive Dietary Table Grid - converts cells to cards on Mobile */
@media (max-width: 600px) {
    .dietary-table, 
    .dietary-tbody, 
    .dietary-tr, 
    .dietary-td {
        display: block;
        width: 100%;
    }

    .dietary-thead {
        display: none; /* Hide column headers */
    }

    .dietary-tr {
        background: #FCFDFD;
        border-bottom: 2px solid var(--border-color);
        padding: 18px;
    }

    .dietary-tr:last-child {
        border-bottom: none;
    }

    .dietary-td {
        padding: 8px 0;
        border: none;
        text-align: left;
    }

    .dietary-td:first-child {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-primary);
        border-bottom: 1.5px solid var(--border-color);
        padding-bottom: 12px;
        margin-bottom: 12px;
        display: block;
        width: 100%;
    }

    .table-radio-label {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 6px 0;
    }

    .table-radio-text {
        display: inline-block;
        font-size: 0.95rem;
        color: var(--text-secondary);
        font-weight: 450;
    }

    .table-radio-circle {
        order: 2; /* Move radio dot to the right */
    }
    
    .other-input-wrapper {
        padding: 12px 0;
    }
}

/* ==========================================================================
   Outbound Submission Button Styling
   ========================================================================== */
.submit-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}

.btn-submit {
    font-family: var(--font-serif);
    background-color: var(--accent-sage);
    color: #FFFFFF;
    border: none;
    border-radius: 30px;
    padding: 18px 48px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(122, 154, 134, 0.25);
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover:not(:disabled) {
    background-color: var(--accent-sage-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(122, 154, 134, 0.35);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: var(--text-light);
    box-shadow: none;
}

/* Loading Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #FFFFFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.btn-submit.loading .spinner {
    display: inline-block;
}

.validation-error-msg {
    color: var(--error-color);
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
    text-align: center;
    line-height: 1.4;
    max-width: 420px;
}

/* ==========================================================================
   Status Cards (Success & Error States)
   ========================================================================== */
.status-card {
    display: none;
    text-align: center;
    padding: 48px 24px;
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.status-card.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    font-size: 2rem;
    box-shadow: var(--shadow-sm);
}

.status-icon.success {
    background-color: var(--accent-sage-light);
    color: var(--accent-sage-dark);
}

.status-icon.error {
    background-color: #FEE2E2;
    color: var(--error-color);
}

.status-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 700;
}

.status-text {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin: 0;
    font-weight: 400;
}

.status-divider {
    width: 60px;
    height: 2px;
    background-color: var(--accent-sage);
    margin: 20px 0;
    opacity: 0.5;
}

/* ==========================================================================
   Language Toggle Button
   ========================================================================== */
.lang-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    font-family: var(--font-serif);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    outline: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lang-toggle-btn:hover {
    border-color: var(--accent-sage);
    background-color: var(--card-bg);
    color: var(--accent-sage);
}

.lang-text {
    transition: var(--transition-smooth);
    color: var(--text-light);
}

.lang-text.active {
    color: var(--accent-sage);
    font-weight: 700;
}

.lang-divider {
    color: var(--border-color);
    font-weight: 300;
}

/* ==========================================================================
   Top Navigation Row (Back Button & Language Switcher)
   ========================================================================== */
.top-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    width: 100%;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-family: var(--font-serif);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    transition: var(--transition-smooth);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.back-link:hover {
    border-color: var(--accent-sage);
    background-color: var(--card-bg);
    color: var(--accent-sage);
}

.back-arrow {
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.back-link:hover .back-arrow {
    transform: translateX(-2px);
}

/* ==========================================================================
   Header Image Banner (Form Pages)
   ========================================================================== */
.rsvp-banner {
    width: 100%;
    height: 300px;
    background-image: url('../inputs/header_image.jpg');
    background-size: cover;
    background-position: center 48%;
    position: relative;
    background-repeat: no-repeat;
}

.rsvp-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--accent-sage);
}

.rsvp-content {
    padding: 40px 48px;
}

.title-part {
    display: inline-block;
    white-space: nowrap;
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { max-height: 0; opacity: 0; transform: translateY(-10px); }
    to { max-height: 200px; opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
