/**
 * RCS WooCommerce Booking - Frontend Styles
 */

/* ============================================
   Variables
   ============================================ */
:root {
    --rcs-primary: #667eea;
    --rcs-primary-dark: #5a67d8;
    --rcs-primary-light: #7c8ff4;
    --rcs-secondary: #764ba2;
    --rcs-success: #48bb78;
    --rcs-success-light: #9ae6b4;
    --rcs-danger: #f56565;
    --rcs-warning: #ed8936;
    --rcs-gray-50: #f9fafb;
    --rcs-gray-100: #f7fafc;
    --rcs-gray-200: #edf2f7;
    --rcs-gray-300: #e2e8f0;
    --rcs-gray-400: #cbd5e0;
    --rcs-gray-500: #a0aec0;
    --rcs-gray-600: #718096;
    --rcs-gray-700: #4a5568;
    --rcs-gray-800: #2d3748;
    --rcs-gray-900: #1a202c;
    --rcs-radius: 12px;
    --rcs-radius-sm: 8px;
    --rcs-radius-lg: 16px;
    --rcs-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --rcs-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --rcs-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --rcs-transition: all 0.2s ease;
}

/* ============================================
   Booking Button
   ============================================ */
.rcs-booking-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--rcs-primary) 0%, var(--rcs-secondary) 100%);
    border: none;
    border-radius: var(--rcs-radius);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--rcs-transition);
    box-shadow: var(--rcs-shadow);
    margin: 10px 0;
}

.rcs-booking-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--rcs-shadow-lg);
    opacity: 0.95;
}

.rcs-booking-btn:active {
    transform: translateY(0);
}

.rcs-booking-btn .rcs-btn-icon {
    font-size: 18px;
}

/* ============================================
   Modal Styles
   ============================================ */
.rcs-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rcs-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.rcs-modal-container {
    position: relative;
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    background: #fff;
    border-radius: var(--rcs-radius-lg);
    box-shadow: var(--rcs-shadow-xl);
    overflow: hidden;
    animation: rcs-modal-in 0.3s ease;
}

@keyframes rcs-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.rcs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--rcs-primary) 0%, var(--rcs-secondary) 100%);
    color: #fff;
}

.rcs-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.rcs-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: var(--rcs-transition);
}

.rcs-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.rcs-modal-body {
    padding: 0;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* ============================================
   Two-Column Booking Layout
   ============================================ */
.rcs-booking-layout {
    display: flex;
    min-height: 500px;
}

.rcs-booking-calendar-col {
    flex: 0 0 70%;
    padding: 24px;
    background: var(--rcs-gray-50);
    border-right: 1px solid var(--rcs-gray-200);
}

.rcs-booking-slots-col {
    flex: 0 0 30%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* ============================================
   Calendar Wrapper
   ============================================ */
.rcs-calendar-wrapper {
    background: #fff;
    border-radius: var(--rcs-radius);
    box-shadow: var(--rcs-shadow);
    overflow: hidden;
}

.rcs-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--rcs-primary) 0%, var(--rcs-secondary) 100%);
    color: #fff;
}

.rcs-cal-month-year {
    font-size: 18px;
    font-weight: 600;
}

.rcs-cal-nav {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: var(--rcs-transition);
}

.rcs-cal-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.rcs-cal-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rcs-calendar-body {
    padding: 16px;
}

.rcs-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.rcs-cal-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--rcs-gray-500);
    text-transform: uppercase;
    padding: 8px 0;
}

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

.rcs-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--rcs-transition);
    position: relative;
    color: var(--rcs-gray-700);
}

.rcs-cal-day.empty {
    cursor: default;
}

.rcs-cal-day.available {
    background: var(--rcs-success-light);
    color: var(--rcs-gray-800);
}

.rcs-cal-day.available:hover {
    background: var(--rcs-success);
    color: #fff;
    transform: scale(1.1);
    box-shadow: var(--rcs-shadow);
}

.rcs-cal-day.unavailable {
    background: var(--rcs-gray-200);
    color: var(--rcs-gray-400);
    cursor: not-allowed;
    text-decoration: line-through;
}

.rcs-cal-day.past {
    color: var(--rcs-gray-400);
    cursor: not-allowed;
}

.rcs-cal-day.selected {
    background: linear-gradient(135deg, var(--rcs-primary) 0%, var(--rcs-secondary) 100%);
    color: #fff;
    font-weight: 600;
    transform: scale(1.15);
    box-shadow: var(--rcs-shadow-lg);
}

.rcs-cal-day.today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: var(--rcs-primary);
    border-radius: 50%;
}

.rcs-cal-day.selected.today::after {
    background: #fff;
}

/* Calendar Legend */
.rcs-calendar-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    background: var(--rcs-gray-50);
    border-top: 1px solid var(--rcs-gray-200);
}

.rcs-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--rcs-gray-600);
}

.rcs-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.rcs-dot.available {
    background: var(--rcs-success);
}

.rcs-dot.unavailable {
    background: var(--rcs-gray-400);
}

.rcs-dot.selected {
    background: var(--rcs-primary);
}

/* ============================================
   Time Slots Column
   ============================================ */
.rcs-slots-header {
    margin-bottom: 16px;
}

.rcs-slots-header h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--rcs-gray-800);
}

.rcs-selected-date {
    font-size: 14px;
    color: var(--rcs-primary);
    font-weight: 500;
}

/* Placeholder state */
.rcs-slots-placeholder,
.rcs-slots-loading,
.rcs-slots-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--rcs-gray-500);
}

.rcs-placeholder-icon,
.rcs-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.rcs-slots-placeholder p,
.rcs-slots-loading p,
.rcs-slots-empty p {
    margin: 0;
    font-size: 14px;
}

/* Loading spinner */
.rcs-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--rcs-gray-200);
    border-top-color: var(--rcs-primary);
    border-radius: 50%;
    animation: rcs-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes rcs-spin {
    to { transform: rotate(360deg); }
}

/* Time slots list */
.rcs-slots-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
}

.rcs-time-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: var(--rcs-gray-50);
    border: 2px solid var(--rcs-gray-200);
    border-radius: var(--rcs-radius-sm);
    cursor: pointer;
    transition: var(--rcs-transition);
}

.rcs-time-slot:hover {
    border-color: var(--rcs-primary);
    background: var(--rcs-gray-100);
}

.rcs-time-slot.selected {
    background: linear-gradient(135deg, var(--rcs-primary) 0%, var(--rcs-secondary) 100%);
    border-color: var(--rcs-primary);
    color: #fff;
}

.rcs-time-slot .slot-time {
    font-size: 15px;
    font-weight: 600;
}

.rcs-time-slot .slot-availability {
    font-size: 12px;
    color: var(--rcs-gray-500);
}

.rcs-time-slot.selected .slot-availability {
    color: rgba(255, 255, 255, 0.8);
}

.rcs-time-slot .slot-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--rcs-primary);
}

.rcs-time-slot.selected .slot-price {
    color: #fff;
}

/* ============================================
   Booking Summary
   ============================================ */
.rcs-booking-summary {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--rcs-gray-200);
}

.rcs-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.rcs-summary-label {
    color: var(--rcs-gray-600);
}

.rcs-summary-date,
.rcs-summary-time {
    font-weight: 500;
    color: var(--rcs-gray-800);
}

.rcs-summary-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin: 12px 0;
    border-top: 1px dashed var(--rcs-gray-300);
    border-bottom: 1px dashed var(--rcs-gray-300);
}

.rcs-price-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--rcs-gray-700);
}

.rcs-price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--rcs-primary);
}

.rcs-book-now-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--rcs-success) 0%, #38a169 100%);
    border: none;
    border-radius: var(--rcs-radius-sm);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--rcs-transition);
}

.rcs-book-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--rcs-shadow-lg);
}

.rcs-book-now-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.rcs-book-now-btn.loading {
    position: relative;
    color: transparent;
}

.rcs-book-now-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rcs-spin 0.8s linear infinite;
}

/* ============================================
   Inline Booking Form
   ============================================ */
.rcs-inline-booking {
    margin: 20px 0;
}

.rcs-inline-booking .rcs-booking-layout {
    border: 1px solid var(--rcs-gray-200);
    border-radius: var(--rcs-radius);
    overflow: hidden;
    box-shadow: var(--rcs-shadow);
}

/* ============================================
   Standalone Calendar
   ============================================ */
.rcs-calendar-standalone {
    max-width: 400px;
    margin: 20px 0;
}

/* ============================================
   Error States
   ============================================ */
.rcs-error {
    padding: 16px 20px;
    background: rgba(245, 101, 101, 0.1);
    border: 1px solid var(--rcs-danger);
    border-radius: var(--rcs-radius-sm);
    color: var(--rcs-danger);
    text-align: center;
    font-size: 14px;
}

/* ============================================
   Elementor Editor Placeholder
   ============================================ */
.rcs-elementor-placeholder {
    padding: 60px 20px;
    background: var(--rcs-gray-100);
    border: 2px dashed var(--rcs-gray-400);
    border-radius: var(--rcs-radius);
    text-align: center;
    color: var(--rcs-gray-600);
}

.rcs-elementor-placeholder p {
    margin: 0;
    font-size: 14px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .rcs-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .rcs-modal-body {
        max-height: calc(100vh - 70px);
    }

    .rcs-booking-layout {
        flex-direction: column;
        min-height: auto;
    }

    .rcs-booking-calendar-col,
    .rcs-booking-slots-col {
        flex: none;
        width: 100%;
    }

    .rcs-booking-calendar-col {
        border-right: none;
        border-bottom: 1px solid var(--rcs-gray-200);
    }

    .rcs-booking-slots-col {
        min-height: 300px;
    }

    .rcs-calendar-legend {
        flex-wrap: wrap;
        gap: 12px;
    }

    .rcs-slots-placeholder,
    .rcs-slots-loading,
    .rcs-slots-empty {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .rcs-booking-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
    }

    .rcs-modal-header {
        padding: 16px;
    }

    .rcs-modal-title {
        font-size: 18px;
    }

    .rcs-booking-calendar-col,
    .rcs-booking-slots-col {
        padding: 16px;
    }

    .rcs-cal-day {
        font-size: 13px;
    }

    .rcs-calendar-legend {
        padding: 12px;
        gap: 10px;
    }

    .rcs-legend-item {
        font-size: 11px;
    }
}

/* ============================================
   WooCommerce Cart Display
   ============================================ */
.woocommerce-cart-form .rcs-booking-info {
    font-size: 13px;
    color: var(--rcs-gray-600);
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--rcs-gray-50);
    border-radius: var(--rcs-radius-sm);
}

.woocommerce-cart-form .rcs-booking-info strong {
    color: var(--rcs-gray-700);
}

/* ============================================
   Gutenberg Block
   ============================================ */
.rcs-booking-block {
    margin: 20px 0;
}
