:root { --primary: #2c3e50; --secondary: #3498db; --bg: #f4f7f6; --error: #e74c3c;}

/* Red Asterisk Styling */
.required { color: var(--error) !important; margin-left: 2px; font-weight: bold; display: inline-block;}

body { font-family: 'Segoe UI', sans-serif; background: var(--bg); padding: 20px; color: var(--primary); }

.container { max-width: 950px; margin: 0 auto; background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }

.form-section { border-bottom: 1px solid #eee; padding: 20px 0; }
.section-title { font-size: 1.1rem; font-weight: bold; margin-bottom: 15px; display: block; }

/* Scheduler Grid Stability */
.scheduler-container { display: flex; flex-direction: row; border: 1px solid #ddd; border-radius: 12px; height: 420px; overflow: hidden; }
.calendar-side { flex: 1; padding: 15px; border-right: 1px solid #eee; display: flex; flex-direction: column; }
.time-side { flex: 1.2; padding: 15px; background: #f9f9f9; display: flex; flex-direction: column; }

.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.calendar-days div { height: 45px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 4px; font-weight: bold; }
.day-available { color: #27ae60; }
.day-padding { color: #ccc; cursor: default; }
.day-selected { background: var(--secondary) !important; color: white !important; }

/* 1. Add this to force horizontal alignment */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; width: 100%;}
/* 2. Ensure the Month/Year text doesn't push the buttons away */
.calendar-header h3 { margin: 0; font-size: 1.1rem; text-align: center; flex-grow: 1; /* This lets the title sit in the middle */}
/* 3. Style the arrows to look like buttons */
.calendar-header button { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 5px 12px; cursor: pointer; font-weight: bold; transition: 0.2s;}
.calendar-header button:hover { background: #f0f0f0; }

.time-slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; overflow-y: auto; }
.time-btn { padding: 10px; border: 1px solid var(--secondary); background: white; color: var(--secondary); border-radius: 6px; cursor: pointer; transition: 0.2s; }
.time-btn.selected { background: var(--secondary); color: white; }

/* Layout Grids */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.guest-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.grid-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.span-2 { grid-column: span 2; }
.span-full { grid-column: span 3; }

label { display: block; font-weight: bold; font-size: 0.85rem; margin-bottom: 5px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95rem; box-sizing: border-box; }
.radio-group-row { display: flex; gap: 15px; margin-bottom: 10px; flex-wrap: wrap; }
.radio-label { font-weight: normal; font-size: 0.85rem; display: flex; align-items: center; gap: 5px; cursor: pointer; }

.button-group { display: flex; gap: 15px; margin-top: 25px; }
.btn-submit { flex: 2; padding: 15px; background: var(--secondary); color: white; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; }
.btn-clear { flex: 1; background: #bdc3c7; color: white; border: none; border-radius: 6px; cursor: pointer; }

.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); justify-content: center; align-items: center; z-index: 100; }
.overlay-content { background: white; padding: 30px; border-radius: 10px; text-align: center; }

.logo-container { text-align: center; margin-bottom: 10px; }
.form-logo { max-height: 100px; }

@media (max-width: 800px) {
    .grid-3, .guest-grid, .scheduler-container { flex-direction: column; height: auto; display: block; }
    .span-2, .span-full { grid-column: 1 !important; }
    .radio-group-row { display: flex; align-items: flex-start; gap: 5px; flex-wrap: wrap;}
    .container { padding: 10px; }
}

/* --- Modal Logic --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 10px;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 950px;
    border-radius: 12px;
    position: relative;
    margin: 40px auto;
}

.close-modal {
    position: absolute;
    right: 20px; top: 15px;
    font-size: 35px;
    cursor: pointer;
    z-index: 10001;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .scheduler-container {
        flex-direction: column; /* Stack calendar and time slots */
        height: auto;
    }
    
    .calendar-side {
        border-right: none;
        border-bottom: 1px solid #eee;
    }

    .form-grid {
        grid-template-columns: 1fr; /* Single column for inputs */
    }

    .modal-content {
        margin: 10px auto;
    }
}

.overlay-content .button-group {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
}

.overlay-content h3 {
    color: var(--secondary);
    margin-top: 10px;
}

/* Back Button (X) Styling */
.back-x-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    font-weight: 300;
    color: var(--primary);
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
}

.back-x-btn:hover {
    color: var(--error);
    transform: scale(1.1);
}

/* Ensure the container can anchor the absolute button */
.container {
    position: relative; /* Required for the absolute positioning of the X */
    max-width: 950px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Adjust for mobile to prevent overlap with logo/content */
@media (max-width: 800px) {
    .back-x-btn {
        top: 10px;
        right: 15px;
        font-size: 28px;
    }
}