:root {
    --primary-color: #5d6d9e;
    --primary-hover: #4a5880;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --error-color: #dc3545;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    /* Narrower for focus */
    margin: 0 auto;
}

/* Hero Section */
header {
    background: linear-gradient(135deg, var(--primary-color), #4a90e2);
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    margin: 15px 0 0 0;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
}

header p {
    margin-top: 10px;
    font-size: 1.1rem;
    opacity: 0.9;
}

.logo-container {
    margin-bottom: 15px;
    display: inline-block;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.logo {
    height: 80px;
    width: auto;
    display: block;
}

.step-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    border-left: 5px solid var(--primary-color);
}

.step-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Calendar UI */
.calendar-wrapper {
    max-width: 400px;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.calendar-header button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
}

.calendar-header button:hover {
    background: #f0f2f5;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.calendar-day-header {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-bottom: 5px;
}

.calendar-day {
    padding: 10px 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.calendar-day:hover:not(.disabled) {
    background-color: #e9ecef;
}

.calendar-day.selected {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.calendar-day.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-day.today {
    border: 1px solid var(--primary-color);
}

.calendar-day.empty {
    cursor: default;
}

/* Inline Expansion */
.slots-expansion {
    grid-column: 1 / -1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: expand 0.3s ease-out;
}

@keyframes expand {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slots-header {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.slot-label {
    display: block;
    cursor: pointer;
    position: relative;
}

.slot-label input {
    position: absolute;
    opacity: 0;
}

.slot-box {
    display: block;
    padding: 10px;
    background: #f0f2f5;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    border: 2px solid transparent;
    transition: all 0.2s;
}

/* Selected State */
.slot-label input:checked+.slot-box {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Disabled State (Booked) */
.slot-label input:disabled+.slot-box {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Location Radio Cards */
.location-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-card {
    flex: 1;
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.location-name {
    display: block;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    transition: all 0.2s;
}

.radio-card input:checked+.location-name {
    border-color: var(--primary-color);
    background: #eff2fb;
    color: var(--primary-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #218838;
}

.primary-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.error-text {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

/* --- Loading State --- */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 8px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color, #5d6d9e);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Ensure container positioning for overlay */
.slots-grid,
#appointmentList,
#blackoutList {
    position: relative;
    min-height: 100px;
    /* Prevent collapse during load */
}

/* --- Mobile Optimization --- */
@media (max-width: 600px) {

    /* Container Padding */
    .container {
        padding: 0 10px;
    }

    /* Hero Logo - Smaller */
    .logo {
        height: 50px;
        width: auto;
    }

    header {
        padding: 20px 10px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    /* Calendar */
    .calendar-wrapper {
        margin: 0;
        max-width: 100%;
    }

    .calendar-day {
        font-size: 0.8rem;
        padding: 8px 2px;
    }

    /* Slots Grid - Stacked or 2-col */
    .slots-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Location Cards - Stack */
    .location-options {
        flex-direction: column;
        gap: 10px;
    }

    .radio-card {
        width: 100%;
    }

    .location-name {
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Buttons - Full Width */
    .submit-btn,
    .primary-btn {
        padding: 15px;
        font-size: 1rem;
    }

    /* Modal - Full Screen-ish */
    .modal-content {
        width: 90%;
        max-width: none;
        padding: 20px;
        margin: 0 5%;
    }

    /* Admin Dashboard */
    #adminDashboard h3 {
        font-size: 1.2rem;
    }

    #appointmentList .delete-btn,
    #appointmentList .edit-btn {
        padding: 8px 15px;
        /* Larger touch targets */
    }
}