/* ============================================
   School Appointment Booking — Frontend Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@400;500;600;700&display=swap');

/* Reset & Base */
.sab-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.sab-wrapper {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 520px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.04),
        0 4px 6px -1px rgba(0,0,0,0.06),
        0 20px 50px -12px rgba(0,0,0,0.12);
    overflow: hidden;
    position: relative;
}

/* Header */
.sab-header {
    background: linear-gradient(135deg, var(--sab-primary), var(--sab-primary-dark));
    padding: 28px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.sab-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.sab-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 10%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.sab-header-icon {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 1;
}

.sab-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.sab-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Steps */
.sab-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 32px 8px;
    gap: 0;
}

.sab-step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.sab-step.active {
    opacity: 1;
}

.sab-step.completed {
    opacity: 0.7;
}

.sab-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sab-step.active .sab-step-num {
    background: var(--sab-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.sab-step.completed .sab-step-num {
    background: #16a34a;
    color: #fff;
}

.sab-step-label {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

.sab-step-line {
    width: 40px;
    height: 2px;
    background: #e5e7eb;
    margin: 0 8px;
    border-radius: 1px;
}

/* Calendar Section */
.sab-section {
    display: none;
    padding: 20px 28px 28px;
    animation: sabFadeIn 0.3s ease;
}

.sab-section.active {
    display: block;
}

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

.sab-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sab-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
}

.sab-nav-btn:hover {
    background: var(--sab-primary-light);
    border-color: var(--sab-primary);
    color: var(--sab-primary);
}

.sab-month-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

/* Calendar Grid */
.sab-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.sab-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 0;
}

.sab-day-header.sab-weekend {
    color: #d1d5db;
}

.sab-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.sab-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    position: relative;
    border: none;
    background: transparent;
}

.sab-day:hover:not(.sab-day-disabled):not(.sab-day-empty) {
    background: var(--sab-primary-light);
    color: var(--sab-primary);
    transform: scale(1.05);
}

.sab-day.sab-day-today {
    font-weight: 700;
    color: var(--sab-primary);
}

.sab-day.sab-day-today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--sab-primary);
}

.sab-day.sab-day-selected {
    background: var(--sab-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    transform: scale(1.05);
}

.sab-day.sab-day-selected::after {
    display: none;
}

.sab-day.sab-day-disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background: transparent;
}

.sab-day.sab-day-disabled:hover {
    transform: none;
    background: transparent;
}

.sab-day.sab-day-empty {
    cursor: default;
}

/* Time Slots Section */
.sab-selected-date-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.sab-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.sab-back-btn:hover {
    background: #f9fafb;
    color: #374151;
}

#sab-selected-date-text {
    font-weight: 600;
    font-size: 15px;
    color: #111827;
}

.sab-slots-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sab-slot {
    padding: 12px 8px;
    text-align: center;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    background: #fff;
    position: relative;
}

.sab-slot:hover:not(.sab-slot-booked):not(.sab-slot-past) {
    border-color: var(--sab-primary);
    background: var(--sab-primary-light);
    color: var(--sab-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.15);
}

.sab-slot.sab-slot-selected {
    border-color: var(--sab-primary);
    background: var(--sab-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.sab-slot.sab-slot-booked {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
    cursor: not-allowed;
    text-decoration: line-through;
    opacity: 0.6;
}

.sab-slot.sab-slot-past {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #d1d5db;
    cursor: not-allowed;
}

.sab-slot-label {
    font-size: 10px;
    color: #9ca3af;
    display: block;
    margin-top: 2px;
}

.sab-slot.sab-slot-booked .sab-slot-label {
    color: #f87171;
    text-decoration: none;
}

/* Loading */
.sab-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 0;
    color: #9ca3af;
}

.sab-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--sab-primary);
    border-radius: 50%;
    animation: sabSpin 0.7s linear infinite;
    margin: 0 auto 12px;
}

.sab-spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sabSpin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes sabSpin {
    to { transform: rotate(360deg); }
}

/* No Slots */
.sab-no-slots {
    text-align: center;
    padding: 40px 20px;
}

.sab-no-slots p {
    color: #9ca3af;
    margin-top: 12px;
    font-size: 14px;
}

/* Modal */
.sab-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: sabFadeIn 0.2s ease;
}

.sab-modal-overlay.active {
    display: flex;
}

.sab-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    animation: sabSlideUp 0.3s ease;
}

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

.sab-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.sab-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.sab-modal-header {
    padding: 28px 28px 16px;
    border-bottom: 1px solid #f3f4f6;
}

.sab-modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.sab-modal-slot-info {
    font-size: 14px;
    color: var(--sab-primary);
    font-weight: 500;
    margin-top: 4px;
}

.sab-modal-body {
    padding: 24px 28px 28px;
}

/* Form */
.sab-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.sab-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.sab-req {
    color: #ef4444;
}

.sab-form-group input,
.sab-form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    background: #fff;
    transition: all 0.2s;
    outline: none;
}

.sab-form-group input:focus,
.sab-form-group select:focus {
    border-color: var(--sab-primary);
    box-shadow: 0 0 0 3px var(--sab-primary-light);
}

.sab-form-group input::placeholder {
    color: #c4c7cc;
}

.sab-form-group input.sab-input-error,
.sab-form-group select.sab-input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.sab-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--sab-primary), var(--sab-primary-dark));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.sab-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}

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

.sab-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Success */
.sab-success {
    text-align: center;
    padding: 40px 28px;
}

.sab-success-icon {
    margin-bottom: 16px;
    animation: sabBounce 0.5s ease;
}

@keyframes sabBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.sab-success h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 8px;
}

.sab-success p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.sab-success-details {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    font-size: 13px;
    color: #374151;
    line-height: 1.8;
    margin-bottom: 20px;
}

.sab-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: #fff !important;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.sab-whatsapp-btn:hover {
    background: #1ebe57;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,211,102,0.3);
}

.sab-new-booking-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #f3f4f6;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    margin-top: 8px;
}

.sab-new-booking-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Responsive */
@media (max-width: 600px) {
    .sab-wrapper {
        margin: 16px;
        border-radius: 16px;
    }

    .sab-header {
        padding: 22px 20px;
    }

    .sab-section {
        padding: 16px 20px 24px;
    }

    .sab-form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sab-slots-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .sab-steps {
        padding: 16px 16px 4px;
    }

    .sab-step-label {
        display: none;
    }

    .sab-modal-body {
        padding: 20px;
    }

    .sab-modal-header {
        padding: 22px 20px 14px;
    }
}
