/**
 * Clarity Space Calendar Styles
 * Responsive calendar with week/day/month views
 */

/* ============================================================================
   CALENDAR BASE
   ============================================================================ */

.calendar {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 12px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
}

.calendar-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.calendar-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.calendar-prev,
.calendar-next {
    padding: 8px;
}

.calendar-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.calendar-views {
    display: flex;
    gap: 4px;
}

.calendar-body {
    flex: 1;
    overflow: auto;
}

/* ============================================================================
   WEEK VIEW
   ============================================================================ */

.calendar-week {
    display: flex;
    min-height: 100%;
}

.calendar-time-column {
    flex-shrink: 0;
    width: 60px;
    border-right: 1px solid #e5e7eb;
}

.calendar-time-column .calendar-day-header {
    height: 60px;
    border-bottom: 1px solid #e5e7eb;
}

.calendar-hour-label {
    height: 60px;
    padding: 4px 8px;
    font-size: 12px;
    color: #6b7280;
    text-align: right;
}

.calendar-day-column {
    flex: 1;
    min-width: 100px;
    border-right: 1px solid #e5e7eb;
}

.calendar-day-column:last-child {
    border-right: none;
}

.calendar-day-column.today {
    background: #eff6ff;
}

.calendar-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60px;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.calendar-day-name {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
}

.calendar-day-number {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.calendar-day-number.today-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: white;
    border-radius: 50%;
}

.calendar-day-slots {
    position: relative;
    height: calc(13 * 60px); /* 8am - 8pm = 13 hours */
}

.calendar-hour-slot {
    height: 60px;
    border-bottom: 1px solid #f3f4f6;
}

.calendar-events {
    position: absolute;
    top: 0;
    left: 4px;
    right: 4px;
}

/* ============================================================================
   DAY VIEW
   ============================================================================ */

.calendar-day {
    display: flex;
    min-height: 100%;
}

.calendar-day .calendar-day-column {
    flex: 1;
}

/* ============================================================================
   MONTH VIEW
   ============================================================================ */

.calendar-month {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.calendar-month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e5e7eb;
}

.calendar-month-day-name {
    padding: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
    text-transform: uppercase;
}

.calendar-month-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.calendar-month-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
    min-height: 80px;
}

.calendar-month-day {
    padding: 8px;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.15s;
}

.calendar-month-day:hover {
    background: #f9fafb;
}

.calendar-month-day:nth-child(7) {
    border-right: none;
}

.calendar-month-day.other-month {
    background: #f9fafb;
}

.calendar-month-day.other-month .calendar-month-day-number {
    color: #9ca3af;
}

.calendar-month-day.today {
    background: #eff6ff;
}

.calendar-month-day-number {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.calendar-month-day.today .calendar-month-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
}

.calendar-month-day-events {
    margin-top: 4px;
}

.calendar-month-indicator {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.calendar-month-indicator.available {
    background: #dcfce7;
    color: #166534;
}

.calendar-month-indicator.booked {
    background: #fef3c7;
    color: #92400e;
}

/* ============================================================================
   TIME SLOTS
   ============================================================================ */

.calendar-slot {
    position: absolute;
    left: 0;
    right: 0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.15s;
    min-height: 30px;
}

.calendar-slot.available {
    background: #dcfce7;
    border-left: 3px solid #22c55e;
    color: #166534;
}

.calendar-slot.available:hover {
    background: #bbf7d0;
}

.calendar-slot.booked {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    color: #92400e;
}

.calendar-slot.selected {
    background: #dbeafe;
    border-left: 3px solid #2563eb;
    color: #1e40af;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-slot-time {
    font-weight: 500;
}

.calendar-slot-status {
    font-size: 11px;
    opacity: 0.8;
}

/* ============================================================================
   BOOKING MODAL
   ============================================================================ */

.booking-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.booking-modal-overlay.visible {
    opacity: 1;
}

.booking-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.booking-modal-overlay.visible .booking-modal {
    transform: translateY(0);
}

.booking-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.booking-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.booking-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.booking-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.booking-modal-body {
    flex: 1;
    overflow: auto;
    padding: 24px;
}

.booking-therapist-info {
    margin-bottom: 20px;
}

.booking-rate {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.booking-instructions {
    margin: 8px 0 0;
    color: #6b7280;
}

.booking-calendar-container {
    height: 400px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.booking-selected-slot {
    margin-top: 20px;
    padding: 16px;
    background: #eff6ff;
    border-radius: 8px;
}

.booking-selected-slot h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
}

.booking-selected-time {
    margin: 0;
    font-size: 16px;
    color: #1e40af;
}

.booking-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
}

.booking-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 44px;
}

.booking-btn-cancel {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
}

.booking-btn-cancel:hover {
    background: #f9fafb;
}

.booking-btn-confirm {
    background: #2563eb;
    border: 1px solid #2563eb;
    color: white;
}

.booking-btn-confirm:hover:not(:disabled) {
    background: #1d4ed8;
}

.booking-btn-confirm:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

.booking-success {
    text-align: center;
    padding: 40px 20px;
}

.booking-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #22c55e;
}

.booking-success h3 {
    margin: 0 0 12px;
    font-size: 24px;
    color: #111827;
}

.booking-success p {
    margin: 0 0 8px;
    color: #6b7280;
}

.booking-success-time {
    font-weight: 600;
    color: #111827;
}

.booking-success-note {
    margin-top: 16px;
    font-size: 14px;
}

.booking-success-amount {
    font-weight: 600;
    color: #22c55e;
    font-size: 18px;
}

.booking-error {
    padding: 12px 16px;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

/* Booking Steps */
.booking-step {
    display: none;
}

.booking-step.active {
    display: block;
}

/* Booking Payment Step */
.booking-payment-summary {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.booking-payment-summary h3 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.booking-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.booking-summary-item:last-child {
    border-bottom: none;
}

.booking-summary-item span:last-child {
    color: #111827;
    font-weight: 500;
}

.booking-summary-total {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 2px solid #e5e7eb;
    border-bottom: none;
}

.booking-summary-total span:first-child {
    font-weight: 600;
    color: #111827;
}

.booking-summary-total span:last-child {
    font-size: 20px;
    font-weight: 700;
    color: #22c55e;
}

/* Booking Payment Form */
.booking-payment-form {
    margin-bottom: 16px;
}

.booking-payment-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.booking-card-element {
    padding: 14px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.booking-card-element:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.booking-payment-errors {
    margin-top: 8px;
    padding: 12px 16px;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    font-size: 14px;
}

.booking-security-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f0fdf4;
    color: #166534;
    border-radius: 8px;
    font-size: 13px;
}

.booking-security-note svg {
    flex-shrink: 0;
}

/* Back button */
.booking-btn-back {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    margin-right: auto;
}

.booking-btn-back:hover {
    background: #f9fafb;
}

/* ============================================================================
   AVAILABILITY EDITOR
   ============================================================================ */

.availability-editor {
    padding: 24px;
}

.availability-section {
    margin-bottom: 32px;
}

.availability-section h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.availability-help {
    margin: 0 0 16px;
    color: #6b7280;
    font-size: 14px;
}

.availability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.availability-day {
    background: #f9fafb;
    border-radius: 8px;
    overflow: hidden;
}

.availability-day-header {
    padding: 12px 16px;
    background: #e5e7eb;
    font-weight: 600;
    color: #374151;
}

.availability-day-slots {
    padding: 12px 16px;
    min-height: 60px;
}

.availability-day-empty {
    color: #9ca3af;
    font-size: 14px;
}

.availability-slot-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.availability-slot-item:last-child {
    border-bottom: none;
}

.availability-slot-time {
    flex: 1;
    font-size: 14px;
    color: #111827;
}

.availability-slot-duration {
    font-size: 12px;
    color: #6b7280;
}

.availability-slot-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
}

.availability-slot-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.availability-btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 44px;
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
}

.availability-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.availability-btn-add {
    border-style: dashed;
}

.availability-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.availability-btn-primary:hover {
    background: #1d4ed8;
}

.blocked-slots-list {
    margin-bottom: 16px;
}

.blocked-slot-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fef3c7;
    border-radius: 8px;
    margin-bottom: 8px;
}

.blocked-slot-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.blocked-slot-date {
    font-weight: 500;
    color: #92400e;
}

.blocked-slot-reason {
    font-size: 13px;
    color: #a16207;
}

.blocked-slot-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #92400e;
    cursor: pointer;
    transition: all 0.15s;
}

.blocked-slot-delete:hover {
    background: #fde68a;
}

.availability-empty {
    color: #9ca3af;
    font-size: 14px;
    padding: 16px;
    text-align: center;
    background: #f9fafb;
    border-radius: 8px;
}

.availability-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.availability-modal-overlay.visible {
    opacity: 1;
}

.availability-modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.availability-modal h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.availability-error {
    padding: 12px 16px;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-nav {
        justify-content: center;
    }

    .calendar-title {
        text-align: center;
        font-size: 16px;
    }

    .calendar-views {
        justify-content: center;
    }

    .calendar-week {
        min-width: 600px;
    }

    .calendar-time-column {
        width: 50px;
    }

    .calendar-hour-label {
        font-size: 11px;
        padding: 4px;
    }

    .calendar-day-column {
        min-width: 80px;
    }

    .booking-modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .booking-calendar-container {
        height: 300px;
    }

    .availability-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .calendar-btn {
        padding: 6px 10px;
        font-size: 13px;
    }

    .calendar-month-day {
        padding: 4px;
    }

    .calendar-month-day-number {
        font-size: 12px;
    }

    .calendar-month-indicator {
        font-size: 9px;
        padding: 1px 4px;
    }
}
