@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Montserrat:wght@300;400;500;600&display=swap');

/* Root Variables - Refined Palette */
:root {
    --emerald: #047857;
    --emerald-dark: #065f46;
    --emerald-light: #d1fae5;
    --gold: #b8860b;
    --cream: #fdfbf7;
    --stone: #1c1917;
    --stone-medium: #57534e;
    --stone-light: #78716c;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--cream);
    min-height: 100vh;
    color: var(--stone);
}

h1, h2, h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Container */
.invitation-container {
    background: white;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #e7e5e4;
    max-width: 480px;
    margin: 0 auto;
}

/* Header */
.invitation-header {
    text-align: center;
    padding: 2rem 2rem 1.25rem;
    background: white;
    border-bottom: 1px solid var(--emerald);
}

.invitation-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--stone);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.invitation-subtitle {
    font-size: 0.75rem;
    color: var(--emerald-dark);
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-weight: 500;
}

/* Countdown Timer */
.countdown-section {
    background: var(--emerald-dark);
    padding: 1rem 1.5rem;
}

.countdown-title {
    text-align: center;
    color: var(--emerald-light);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.countdown {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.countdown-item {
    text-align: center;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    min-width: 60px;
}

.countdown-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    font-family: 'Cormorant Garamond', serif;
    line-height: 1;
}

.countdown-label {
    display: block;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* Venue Section */
.venue-section {
    background: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.venue-info {
    padding: 1.25rem 0;
    margin-bottom: 1rem;
    border-top: 1px solid #e7e5e4;
    border-bottom: 1px solid #e7e5e4;
}

.venue-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--stone);
    margin-bottom: 0.5rem;
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 0.05em;
}

.venue-floor {
    font-size: 0.875rem;
    color: var(--stone-medium);
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.venue-address {
    font-size: 0.813rem;
    color: var(--stone-light);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.event-date {
    font-size: 0.875rem;
    color: var(--emerald-dark);
    margin-top: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Dress Code */
.dress-code {
    background: white;
    border: 2px solid var(--emerald);
    padding: 1rem 1.5rem;
    text-align: center;
}

.dress-code-label {
    font-size: 0.688rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--stone-medium);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.dress-code-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--emerald-dark);
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 0.05em;
}

/* Attendee Counter */
.attendee-counter-section {
    background: white;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e7e5e4;
}

.attendee-counter,
.attendee-counter-loading {
    background: linear-gradient(135deg, var(--emerald-dark) 0%, var(--emerald) 100%);
    padding: 1.5rem 2rem;
    text-align: center;
    border-radius: 0;
    position: relative;
    overflow: hidden;
}

.attendee-counter::before {
    content: '❄';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.15);
    animation: float 3s ease-in-out infinite;
}

.attendee-counter::after {
    content: '❄';
    position: absolute;
    bottom: 10px;
    right: 20px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.15);
    animation: float 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.attendee-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    animation: sway 2s ease-in-out infinite;
}

@keyframes sway {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

.attendee-count {
    font-size: 3rem;
    font-weight: 600;
    color: white;
    font-family: 'Cormorant Garamond', serif;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.attendee-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 500;
}

.attendee-count-text {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}

/* Form Sections */
.form-section {
    padding: 1.5rem 2rem 2rem;
}

.form-header {
    text-align: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e7e5e4;
    margin-bottom: 1.5rem;
}

.form-greeting {
    font-size: 1.375rem;
    color: var(--stone);
    font-family: 'Cormorant Garamond', serif;
    margin-bottom: 0.5rem;
}

.form-subtitle {
    font-size: 0.813rem;
    color: var(--stone-light);
}

/* Input Styling */
input[type="text"],
select {
    font-family: 'Montserrat', sans-serif;
}

label {
    font-size: 0.813rem;
    font-weight: 500;
    color: var(--stone-medium);
}

input[type="text"],
select {
    border: 1px solid #d6d3d1;
    transition: all 0.2s ease;
    background: white;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.1);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2357534e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

select option {
    padding: 0.5rem;
}

.guest-card {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    transition: border-color 0.2s ease;
}

.guest-card:hover {
    border-color: var(--emerald-light);
}

/* Radio Buttons */
input[type="radio"] {
    accent-color: var(--emerald);
}

/* Buttons */
.btn-primary {
    background: var(--emerald-dark);
    color: white;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.813rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--emerald);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dietary Notes Display */
.dietary-info {
    background: #fefce8;
    border: 1px solid var(--gold);
    border-radius: 0;
    padding: 1rem;
}

.dietary-label {
    color: var(--stone-medium);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.dietary-text {
    color: var(--stone);
    line-height: 1.6;
    font-size: 0.875rem;
}

/* Success Screen - RSVP Receipt */
.success-screen {
    padding: 1.5rem;
    background: white;
}

/* Receipt Header */
.receipt-header {
    text-align: center;
    padding-bottom: 0.75rem;
}

.receipt-title {
    font-size: 1.5rem;
    color: var(--stone);
    font-family: 'Cormorant Garamond', serif;
    margin-bottom: 0.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.receipt-subtitle {
    font-size: 0.75rem;
    color: var(--emerald-dark);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.125rem;
    font-weight: 500;
}

.receipt-date {
    font-size: 0.75rem;
    color: var(--stone-medium);
    margin-top: 0.125rem;
}

/* Receipt Body */
.receipt-body {
    padding: 0.75rem 0;
}

.receipt-group {
    text-align: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f5f5f4;
}

.receipt-label {
    font-size: 0.625rem;
    color: var(--stone-light);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.125rem;
}

.receipt-value {
    font-size: 1rem;
    color: var(--stone);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

/* Receipt Sections - Conditional Layout */
.receipt-sections-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Full width when only one section */
.receipt-sections-container.has-one {
    grid-template-columns: 1fr;
}

/* Two columns when both sections exist */
.receipt-sections-container.has-both {
    grid-template-columns: 1fr;
}

@media (min-width: 480px) {
    .receipt-sections-container.has-both {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .receipt-sections-container.has-one {
        grid-template-columns: 1fr;
    }
}

.receipt-section {
    margin-bottom: 0;
}

.receipt-section-title {
    font-size: 0.688rem;
    color: var(--emerald-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-weight: 600;
    border-left: 2px solid var(--emerald);
    padding-left: 0.5rem;
}

.receipt-guest-list {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
}

.receipt-guest-item {
    display: flex;
    align-items: baseline;
    padding: 0.25rem 0;
    border-bottom: 1px dotted #e7e5e4;
}

.receipt-guest-item:last-child {
    border-bottom: none;
}

.receipt-guest-number {
    font-size: 0.688rem;
    color: var(--stone-light);
    margin-right: 0.5rem;
    min-width: 1.25rem;
    font-family: 'Cormorant Garamond', serif;
}

.receipt-guest-name {
    font-size: 0.813rem;
    color: var(--stone);
    flex: 1;
    line-height: 1.3;
}

.receipt-guest-item.attending .receipt-guest-name {
    color: var(--emerald-dark);
    font-weight: 500;
}

.receipt-guest-item.declining .receipt-guest-name {
    color: var(--stone-medium);
    font-style: italic;
}

.receipt-count {
    text-align: center;
    font-size: 0.75rem;
    color: var(--stone-medium);
    padding: 0.375rem 0.5rem;
    border-top: 1px solid #d6d3d1;
    background: white;
}

.receipt-count strong {
    color: var(--stone);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Receipt Footer */
.receipt-footer {
    text-align: center;
    padding-top: 0.75rem;
}

.receipt-timestamp {
    font-size: 0.688rem;
    color: var(--stone-light);
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.receipt-message {
    font-size: 0.813rem;
    color: var(--emerald-dark);
    font-style: italic;
    margin-bottom: 0.25rem;
}

.receipt-venue {
    font-size: 0.75rem;
    color: var(--stone-medium);
}

.divider {
    height: 1px;
    background: #e7e5e4;
    margin: 0.75rem 0;
}

/* Error Messages */
.error-message {
    color: #991b1b;
    background: #fef2f2;
    padding: 0.75rem;
    border-left: 3px solid #991b1b;
    font-size: 0.813rem;
}

/* Branding Footer */
.branding-footer {
    background: white;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e7e5e4;
    text-align: center;
    position: relative;
}

.branding-text {
    font-size: 0.625rem;
    color: #78716c;
    letter-spacing: 0.03em;
    font-weight: 400;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.branding-link {
    color: #57534e;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.branding-link:hover {
    color: var(--emerald-dark);
    border-bottom-color: var(--emerald-dark);
}

.branding-link:active {
    transform: scale(0.98);
}

/* Responsive Design */
@media (max-width: 640px) {
    .invitation-title {
        font-size: 1.75rem;
    }

    .venue-name {
        font-size: 1.25rem;
    }

    .countdown-item {
        min-width: 55px;
        padding: 0.5rem;
    }

    .countdown-value {
        font-size: 1.25rem;
    }

    .dress-code-value {
        font-size: 1.125rem;
    }

    .form-section,
    .venue-section {
        padding: 1.25rem 1.5rem;
    }

    .branding-footer {
        padding: 0.875rem 1rem;
    }

    .branding-text {
        font-size: 0.563rem;
        line-height: 1.4;
        flex-wrap: wrap;
    }

    .attendee-counter-section {
        padding: 1.25rem 1.5rem;
    }

    .attendee-counter,
    .attendee-counter-loading {
        padding: 1.25rem 1.5rem;
    }

    .attendee-icon {
        font-size: 2rem;
    }

    .attendee-count {
        font-size: 2.5rem;
    }

    .attendee-label {
        font-size: 0.688rem;
    }
}

/* Tablet and Landscape Mobile */
@media (min-width: 641px) and (max-width: 1024px) {
    .branding-text {
        font-size: 0.6rem;
    }
}

/* Ensure branding is always visible */
@media print {
    .branding-footer {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* Ensure login page fits without scroll */
@media (min-height: 700px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
