/* Base Calendar Styles - Shared across all calendar views */

.rrs-calendar-container {
    max-width: 1400px;
    margin: 30px auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.rrs-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.rrs-calendar-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rrs-nav-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.rrs-nav-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.rrs-date-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rrs-date-input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    min-width: 160px;
}

.rrs-today-btn {
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.rrs-calendar-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.rrs-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

.rrs-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ddd;
    background: #17a2b8;
}

/* Legend Colors */
.rrs-legend-color.rrs-available {
    background: #28a745;
}

.rrs-legend-color.rrs-selected {
    background: #0d6efd;
}

.rrs-legend-color.rrs-my-hold {
    background: #17a2b8;
}

.rrs-legend-color.rrs-held {
    background: #ffc107;
}

.rrs-legend-color.rrs-booked {
    background: #f8d7da;
}

.rrs-legend-color.rrs-pending {
    background: #fd7e14;
}

/* Common Grid Styles */
.rrs-calendar-grid-container {
    position: relative;
    min-height: 200px;
}

.rrs-calendar-grid {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    display: block;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #2271b1 #f8f9fa;
}

.rrs-calendar-grid::-webkit-scrollbar {
    height: 8px;
}

.rrs-calendar-grid::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.rrs-calendar-grid::-webkit-scrollbar-thumb {
    background-color: #2271b1;
    border-radius: 20px;
}

.rrs-calendar-row {
    display: flex;
    min-width: fit-content;
    border-bottom: 1px solid #e0e0e0;
}

.rrs-lane-header,
.rrs-slot {
    flex: 0 0 var(--rrs-lane-col-width, 160px);
    min-width: var(--rrs-lane-col-width, 160px);
    box-sizing: border-box;
}

.rrs-calendar-header-row {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.rrs-time-label {
    display: none;
}

.rrs-lane-header {
    padding: 15px 10px;
    text-align: center;
    font-size: 13px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rrs-slot {
    padding: 12px;
    text-align: center;
    border-right: 1px solid #e0e0e0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    font-size: 12px;
}

.rrs-slot-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

.rrs-slot-time {
    display: block;
    font-weight: 600;
    font-size: 11px;
}

.rrs-slot-status-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    opacity: 0.9;
}

/* Common States - CRITICAL COLOR DEFINITIONS */
.rrs-slot.unavailable { 
    background: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

.rrs-slot.booked { 
    background: #f8d7da; 
    cursor: not-allowed; 
    color: #721c24;
}

.rrs-slot.available { 
    background: #006d08;
    border-color: #1e7e34;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
}
.rrs-slot.pending{
    background: #00b5b5;cursor: not-allowed;
}
.rrs-slot.available:hover {
    background: #218838;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.rrs-slot.selected-slot,
.rrs-slot.selected {
    background: #0d6efd !important;
    border: 2px solid #0a58ca !important;
    color: #fff !important;
    font-weight: 600;
}

.rrs-slot.held {
    background: #ffc107;
    color: #856404;
    cursor: not-allowed;
}

.rrs-slot.my_hold {
    background: #17a2b8;
    color: #fff;
    cursor: pointer;
}

.rrs-slot.pending {
    background: #fd7e14;
    border-color: #e8690a;
    color: #fff;
    cursor: not-allowed;
}

/* ── Slot Popover ─────────────────────────────────────────────────────────── */

.rrs-calendar-grid-container {
    position: relative; /* anchor for absolute popover */
}

.rrs-slot-popover {
    position: absolute;
    z-index: 120;
    min-width: 220px;
    max-width: 280px;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.08);
    padding: 14px 16px 12px;
    /* entrance animation */
    opacity: 0;
    transform: scale(0.92) translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.rrs-slot-popover.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Arrow pointer toward selected slot */
.rrs-slot-popover::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 44px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid #d0d5dd;
}
.rrs-slot-popover::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 45px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 7px solid #fff;
}

/* Close ×  */
.rrs-popover-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 0 2px;
    transition: color 0.15s;
}
.rrs-popover-close:hover { color: #222; }

/* Content rows */
.rrs-popover-time {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin-bottom: 3px;
    padding-right: 20px; /* clear the × button */
}
.rrs-popover-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}
.rrs-popover-lane {
    font-size: 12px;
    color: #555;
    background: #f0f4f8;
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    margin-bottom: 6px;
}
.rrs-popover-price {
    font-size: 13px;
    font-weight: 600;
    color: #1a7f3c;
    margin-bottom: 10px;
}
.rrs-popover-price .woocommerce-Price-amount { color: inherit; }

/* Actions */
.rrs-popover-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.rrs-popover-book {
    flex: 1;
    font-size: 13px !important;
    padding: 7px 10px !important;
}
.rrs-popover-cancel {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    transition: background 0.15s, color 0.15s;
}
.rrs-popover-cancel:hover {
    background: #f5f5f5;
    color: #333;
}

/* Mobile: popover sticks to bottom of grid container instead of floating */
@media (max-width: 600px) {
    .rrs-slot-popover {
        position: static !important;
        max-width: 100%;
        min-width: 0;
        border-radius: 8px;
        margin-top: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.10);
    }
    .rrs-slot-popover::before,
    .rrs-slot-popover::after { display: none; }
}

/* Legacy: hide any leftover selection panels (belt-and-suspenders) */
.rrs-selection-panel { display: none !important; }

/* "Showing Slots for: <date>" label in the calendar header */
.rrs-showing-date-label {
    font-weight: 600;
    font-size: 18px;
    color: #555;
    text-align: center;
}

.rrs-showing-date-label p {
    margin: 0;
    white-space: nowrap;
}

/* No availability message (shown after auto-advance search exhausts 90 days) */
.rrs-no-availability {
    padding: 40px 20px;
    text-align: center;
    color: #555;
    font-size: 14px;
}

/* Loading */
.rrs-calendar-loading {
    padding: 40px;
    text-align: center;
    color: #666;
}

.rrs-calendar-loading .spinner {
    float: none;
    margin: 0 auto 10px;
}

/* Hold Timer Notice */
.rrs-hold-notice {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rrs-hold-notice .dashicons {
    color: #856404;
}

.rrs-hold-timer {
    color: #d9534f;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .rrs-calendar-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rrs-calendar-controls {
        justify-content: center;
    }
    
    .rrs-calendar-legend {
        justify-content: center;
    }
    
    .rrs-lane-header,
    .rrs-slot {
        flex: 0 0 var(--rrs-lane-col-width, 120px);
        min-width: var(--rrs-lane-col-width, 120px);
        min-height: 50px;
        font-size: 11px;
        padding: 8px;
    }
}
