/* ══════════════════════════════════════════════════════════════════
   Garnet Scheduler — Native Booking Widget
   Glass-morphism booking calendar matching the Garnet Grid aesthetic
   ══════════════════════════════════════════════════════════════════ */

/* ── Container ──────────────────────────────────────────────────── */
.garnet-scheduler {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.scheduler-card {
    background: rgba(15, 15, 20, 0.85);
    border: 1px solid rgba(155, 27, 48, 0.2);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s ease;
}

.scheduler-card:hover {
    border-color: rgba(155, 27, 48, 0.35);
}

/* ── Header ─────────────────────────────────────────────────────── */
.scheduler-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(155, 27, 48, 0.1), rgba(155, 27, 48, 0.03));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scheduler-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #f0f0f0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scheduler-header .duration-badge {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--garnet-main, #9b1b30);
    background: rgba(155, 27, 48, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

/* ── View States ────────────────────────────────────────────────── */
.scheduler-view {
    display: none;
    animation: schedulerFadeIn 0.3s ease;
}

.scheduler-view.active {
    display: block;
}

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

/* ── Week Navigation ────────────────────────────────────────────── */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem 0.5rem;
}

.week-nav-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(240, 240, 240, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.week-nav-btn:hover:not(:disabled) {
    background: rgba(155, 27, 48, 0.15);
    border-color: rgba(155, 27, 48, 0.3);
    color: #f0f0f0;
}

.week-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.week-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(240, 240, 240, 0.7);
    letter-spacing: 0.02em;
}

/* ── Day Grid ───────────────────────────────────────────────────── */
.day-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 0.75rem 1.5rem;
}

.day-cell {
    text-align: center;
    padding: 0.6rem 0.25rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.day-cell:hover:not(.day-cell--empty):not(.day-cell--past) {
    background: rgba(155, 27, 48, 0.1);
    border-color: rgba(155, 27, 48, 0.25);
}

.day-cell.day-cell--selected {
    background: rgba(155, 27, 48, 0.2);
    border-color: var(--garnet-main, #9b1b30);
}

.day-cell.day-cell--past,
.day-cell.day-cell--empty {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.day-cell .day-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(240, 240, 240, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.day-cell .day-num {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(240, 240, 240, 0.85);
}

.day-cell .slot-count {
    font-size: 0.6rem;
    color: var(--garnet-main, #9b1b30);
    margin-top: 0.15rem;
}

.day-cell.day-cell--past .day-num,
.day-cell.day-cell--empty .day-num {
    color: rgba(240, 240, 240, 0.2);
}

/* ── Time Slots ─────────────────────────────────────────────────── */
.time-slots-container {
    padding: 0 1.5rem 1.25rem;
}

.time-slots-header {
    font-size: 0.8rem;
    color: rgba(240, 240, 240, 0.4);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.time-slots-grid::-webkit-scrollbar { width: 3px; }
.time-slots-grid::-webkit-scrollbar-thumb {
    background: rgba(155, 27, 48, 0.3);
    border-radius: 2px;
}

.time-slot-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(240, 240, 240, 0.8);
    padding: 0.6rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
}

.time-slot-btn:hover {
    background: rgba(155, 27, 48, 0.12);
    border-color: rgba(155, 27, 48, 0.35);
    color: #fff;
}

.time-slot-btn.selected {
    background: var(--garnet-main, #9b1b30);
    border-color: var(--garnet-main, #9b1b30);
    color: #fff;
    font-weight: 600;
}

.no-slots-msg {
    text-align: center;
    color: rgba(240, 240, 240, 0.3);
    font-size: 0.8rem;
    padding: 1.5rem 0;
    font-style: italic;
}

/* ── Booking Form ───────────────────────────────────────────────── */
.scheduler-form {
    padding: 1.25rem 1.5rem;
}

.scheduler-form .back-btn {
    background: none;
    border: none;
    color: rgba(240, 240, 240, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0;
    font-family: inherit;
    transition: color 0.2s;
}

.scheduler-form .back-btn:hover {
    color: var(--garnet-main, #9b1b30);
}

.scheduler-selected-slot {
    background: rgba(155, 27, 48, 0.08);
    border: 1px solid rgba(155, 27, 48, 0.2);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: rgba(240, 240, 240, 0.8);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scheduler-selected-slot .slot-icon {
    font-size: 1.1rem;
}

.scheduler-input-group {
    margin-bottom: 0.9rem;
}

.scheduler-input-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(240, 240, 240, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.scheduler-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    color: #e0e0e0;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.scheduler-input:focus {
    border-color: rgba(155, 27, 48, 0.5);
}

.scheduler-input::placeholder {
    color: rgba(240, 240, 240, 0.2);
}

textarea.scheduler-input {
    resize: vertical;
    min-height: 60px;
}

.scheduler-submit {
    width: 100%;
    background: linear-gradient(135deg, #9b1b30, #c0392b);
    border: none;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    position: relative;
    overflow: hidden;
}

.scheduler-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #b82040, #d4374a);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(155, 27, 48, 0.3);
}

.scheduler-submit:disabled {
    opacity: 0.5;
    cursor: default;
}

.scheduler-submit .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: schedulerSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}

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

/* ── Confirmation ───────────────────────────────────────────────── */
.scheduler-confirmation {
    padding: 2rem 1.5rem;
    text-align: center;
}

.confirmation-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    animation: confirmPop 0.5s ease;
}

@keyframes confirmPop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.scheduler-confirmation h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    color: #f0f0f0;
    margin-bottom: 0.5rem;
}

.scheduler-confirmation p {
    font-size: 0.85rem;
    color: rgba(240, 240, 240, 0.5);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.confirmation-details {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 1rem;
    margin: 1.25rem 0;
    text-align: left;
}

.confirmation-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.8rem;
}

.confirmation-detail-row .cd-label {
    color: rgba(240, 240, 240, 0.4);
}

.confirmation-detail-row .cd-value {
    color: #f0f0f0;
    font-weight: 500;
}

.scheduler-new-booking-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(240, 240, 240, 0.6);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    margin-top: 0.75rem;
}

.scheduler-new-booking-btn:hover {
    border-color: rgba(155, 27, 48, 0.3);
    color: #f0f0f0;
}

/* ── Loading State ──────────────────────────────────────────────── */
.scheduler-loading {
    text-align: center;
    padding: 2rem;
    color: rgba(240, 240, 240, 0.3);
    font-size: 0.85rem;
}

.scheduler-loading .loader-dots {
    display: inline-flex;
    gap: 4px;
    margin-top: 0.5rem;
}

.scheduler-loading .loader-dots span {
    width: 6px;
    height: 6px;
    background: rgba(155, 27, 48, 0.5);
    border-radius: 50%;
    animation: dotPulse 1.2s infinite;
}

.scheduler-loading .loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.scheduler-loading .loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40%           { opacity: 1; transform: scale(1.2); }
}

/* ── Error State ────────────────────────────────────────────────── */
.scheduler-error {
    text-align: center;
    padding: 1.5rem;
    color: rgba(240, 100, 100, 0.7);
    font-size: 0.8rem;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .time-slots-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .day-grid {
        gap: 4px;
        padding: 0.5rem 1rem;
    }

    .scheduler-form,
    .time-slots-container,
    .scheduler-confirmation {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
