/**
 * Easy Restaurant Table Booking - Datepicker Styles
 * 
 * @package EasyRestaurantTableBooking
 * @since 1.0.0
 */

/* Date Input Wrapper */
.ertb-date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.ertb-date-input-wrapper .ertb-form-input {
    padding-right: 40px;
    cursor: pointer;
}

.ertb-datepicker-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--ertb-neutral, #374151);
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 10;
}

.ertb-datepicker-toggle:hover {
    background-color: var(--ertb-background, #F9FAFB);
    color: var(--ertb-primary, #D97706);
}

.ertb-datepicker-toggle .ertb-icon {
    width: 16px;
    height: 16px;
    display: block;
}



/* Datepicker Container */
.ertb-datepicker-container {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1000;
    display: none;
}

.ertb-datepicker-container.open {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Datepicker */
.ertb-datepicker {
    background: #FFFFFF !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.08) !important;
    width: 320px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    display: block !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Datepicker Header */
.ertb-datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.ertb-datepicker-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

.ertb-datepicker-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    flex: 1;
    color: white;
    letter-spacing: 0.025em;
    position: relative;
    z-index: 1;
}

.ertb-datepicker-nav {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.ertb-datepicker-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ertb-datepicker-nav .ertb-icon {
    width: 16px;
    height: 16px;
}

/* Datepicker Body */
.ertb-datepicker-body {
    padding: 20px;
    background: #fafbfc;
}

/* Weekdays */
.ertb-datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 12px;
}

.ertb-datepicker-weekdays span {
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    color: #64748b;
    padding: 10px 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f1f5f9;
    border-radius: 6px;
}

/* Days Grid */
.ertb-datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

/* Day Buttons */
.ertb-datepicker-day {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 10px 4px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    transition: all 0.3s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* .ertb-datepicker-day:hover:not(.ertb-datepicker-day-disabled) {
    background-color: var(--ertb-background, #F9FAFB);
    color: var(--ertb-primary, #D97706);
} */

.ertb-datepicker-day:focus {
    outline: 2px solid var(--ertb-primary, #D97706);
    outline-offset: 2px;
}

/* Day States */
.ertb-datepicker-day-other-month {
    color: #cbd5e1;
    background: #f8fafc;
    opacity: 0.7;
}

.ertb-datepicker-day-today {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-weight: 700;
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.ertb-datepicker-day:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ertb-datepicker-day-selected {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-weight: 700;
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.ertb-datepicker-day-selected:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
}

.ertb-datepicker-day-disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #e2e8f0;
    opacity: 0.6;
}

.ertb-datepicker-day-closed {
    color: #6b7280 !important;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%) !important;
    border-color: #d1d5db !important;
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    position: relative;
}

.ertb-datepicker-day-closed::after {
    content: '🚫';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    opacity: 0.8;
}

.ertb-datepicker-day-closed:hover {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%) !important;
    transform: none !important;
    box-shadow: none !important;
}

.ertb-datepicker-day-disabled:hover {
    background: #f8fafc;
    color: #cbd5e1;
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Responsive Design */
@media (max-width: 480px) {
    .ertb-datepicker {
        width: 260px;
        font-size: 13px;
    }
    
    .ertb-datepicker-header {
        padding: 10px 12px;
    }
    
    .ertb-datepicker-title {
        font-size: 15px;
    }
    
    .ertb-datepicker-body {
        padding: 12px;
    }
    
    .ertb-datepicker-day {
        padding: 6px 2px;
        min-height: 32px;
        font-size: 13px;
    }
    
    .ertb-datepicker-weekdays span {
        padding: 6px 2px;
        font-size: 11px;
    }
    
    /* Ensure datepicker doesn't overflow on mobile */
    .ertb-datepicker-container {
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .ertb-datepicker {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
}

/* Animation - only apply when datepicker first opens */
.ertb-datepicker-container.open .ertb-datepicker {
    animation: ertb-datepicker-fade-in 0.2s ease-out;
}

@keyframes ertb-datepicker-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus Management */
.ertb-datepicker-day:focus-visible {
    outline: 2px solid var(--ertb-primary, #D97706);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ertb-datepicker {
        border-width: 2px;
    }
    
    .ertb-datepicker-day {
        border: 1px solid transparent;
    }
    
    .ertb-datepicker-day:hover:not(.ertb-datepicker-day-disabled) {
        border-color: var(--ertb-primary, #D97706);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .ertb-datepicker-container.open .ertb-datepicker {
        animation: none;
    }
    
    .ertb-datepicker-day,
    .ertb-datepicker-nav,
    .ertb-datepicker-toggle {
        transition: none;
    }
} 