:root {
    /* Colors */
    --primary-color: #3e523e; /* Lightened dark green */
    --secondary-color: #d68d8d; /* Rose/Pink for RSVP button */
    --secondary-hover: #e2a5a5;
    --bg-page: #fcfaf9; /* Off-white for page background */
    --bg-card: #e8e3df; /* Beige for card and modal */
    --bg-card-alt: #e9e4e0; /* Slightly darker for card container back */
    --bg-button: #dcd4cf; /* Darker beige for location button */
    --bg-button-hover: #f5f2f0; /* Lighter for hover */

    /* Fonts */
    --font-serif: 'Playfair Display', serif;
    --font-cursive: 'Sacramento', cursive;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Spacing & Sizes */
    --card-width: 450px;
    --border-radius: 4px;
    --border-radius-lg: 10px;
    --border-radius-pill: 15px;
    --transition-speed: 0.2s;
    --transition-speed-slow: 0.3s;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    font-family: var(--font-serif);
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.card-container {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card {
    background-color: var(--bg-card-alt);
    width: var(--card-width);
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 14px;
}

.card-image {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    background-image: url('assets/invitation.jpeg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}

.location-link {
    position: absolute;
    top: 42.5%;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 60%;
    padding: 7px 14px;
    text-decoration: none;
    background-color: var(--bg-card);
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.25rem;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.location-icon {
    width: 20px;
    height: 24px;
    opacity: 0.8;
}

.location-link:hover {
    background-color: var(--bg-button);
    transform: translateX(-50%) translateY(-1px);
    box-shadow: 2px 2px 7px rgba(0, 0, 0, 0.15);
}

.rsvp-button {
    margin-top: -7px;
    padding: 7px 21px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-pill);
    font-family: var(--font-serif);
    font-size: 1rem;
    letter-spacing: 0.05rem;
    cursor: pointer;
    box-shadow: 2px 2px 7px rgba(0, 0, 0, 0.15);
    z-index: 10;
    transition: all var(--transition-speed-slow) ease;
    white-space: nowrap;
}

.rsvp-button:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.rsvp-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.modal {
    display: none;
}

.cursive {
    font-family: var(--font-cursive);
}

#rsvpForm,
#loginForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

#rsvpForm input[type="text"],
#rsvpForm textarea,
#loginForm input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#rsvpForm input[type="text"],
#rsvpForm textarea {
    font-family: var(--font-serif);
}

#loginForm input[type="password"] {
    font-family: var(--font-sans);
}

#rsvpForm textarea {
    resize: vertical;
}

#rsvpForm input[type="radio"],
#rsvpForm input[type="checkbox"] {
    accent-color: var(--primary-color);
    cursor: pointer;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.checkbox-group {
    margin: 5px 0;
    font-size: 0.95rem;
}

.checkbox-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

#rsvpForm button,
#loginForm button {
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#loginForm button {
    font-family: var(--font-sans);
    transition: background-color var(--transition-speed);
}

#loginForm button:hover {
    opacity: 0.9;
}

.admin-page,
.rsvp-page {
    display: block;
    background-color: var(--bg-page);
    padding: 40px 20px;
}

.rsvp-page {
    font-family: var(--font-serif);
}

.admin-page {
    font-family: var(--font-sans);
}

.rsvp-page .admin-container {
    max-width: 500px;
}

.rsvp-page .button-group button,
.rsvp-page .button-group a {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 10px;
}

.admin-container {
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--bg-card);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.admin-container h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-family: var(--font-sans);
}

.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    background-color: white;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 5px;
}

.stat-value {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: bold;
}

.refresh-btn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: opacity var(--transition-speed);
}

.refresh-btn:hover {
    opacity: 0.9;
}

.login-container {
    max-width: 300px;
    margin: 40px auto;
    text-align: center;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.error {
    color: #d9534f;
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: center;
}

.rsvp-table-container {
    overflow-x: auto;
}

.rsvp-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.rsvp-table th,
.rsvp-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dcd4cf;
}

.rsvp-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: normal;
}

.rsvp-table tr:hover {
    background-color: rgba(62, 82, 62, 0.05);
}

.comment-cell {
    font-size: 0.9rem;
    font-style: italic;
    max-width: 300px;
    word-wrap: break-word;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(62, 82, 62, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-top: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-container {
    padding: 20px;
}

.text-center {
    text-align: center;
}

.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }
.ml-10 { margin-left: 10px; }

.error {
    color: #a00;
    text-align: center;
    padding: 20px;
}

.error-message {
    color: #d9534f;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.request-id {
    font-size: 0.85rem;
    color: #666;
    margin-top: 15px;
}

.request-id code {
    background: #eee;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Shared & Utility Classes */
.centered-container {
    min-height: 200px;
}

.title-cursive {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 10px;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 250px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    font-family: var(--font-sans);
    animation: slideIn 0.3s ease-out;
}

.toast.success { background-color: #4b6a4b; }
.toast.error { background-color: #a94442; }
.toast.info { background-color: #31708f; }

.toast-message {
    flex-grow: 1;
    margin-right: 15px;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-speed);
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.result-container {
    text-align: center;
}

.status-title {
    font-size: 2rem;
}

.flex-center {
    display: flex;
    justify-content: center;
}

.gap-10 {
    gap: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.btn-primary {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-danger {
    padding: 10px 20px;
    background-color: #d9534f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-secondary {
    padding: 10px 20px;
    text-decoration: none;
    background-color: #ccc;
    color: #333;
    border-radius: 5px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.btn-flex-1 {
    flex: 1;
}

.text-center {
    text-align: center;
}

.ml-10 {
    margin-left: 10px;
}

.btn-logout {
    background-color: #d9534f;
}

@media (max-width: 500px) {
    body {
        background-color: var(--bg-card);
    }

    .card {
        width: 100vw;
        box-shadow: none;
        padding-bottom: 40px;
        min-height: 100vh;
    }

    .card-image {
        height: 141.4vw;
    }

    .card-container {
        padding: 0;
        background-color: var(--bg-card);
    }
}
