/* Custom Date Range Picker - BetterBeds Design */

.bb-datepicker-calendar {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1060;
    display: none;
    padding: 0;
    overflow: hidden !important;
    font-family: 'Inter', sans-serif;
    /* Sauberes Clipping der border-radius */
    backface-visibility: hidden;
    transform: translateZ(0);
}

.bb-datepicker-calendar.active {
    display: block;
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.bb-datepicker-header {
    background: linear-gradient(135deg, #4337ed 80%, #5a4dff 100%);
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    position: relative;
    border-radius: 20px 20px 0 0 !important;
}

.bb-datepicker-nav {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.bb-datepicker-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.bb-datepicker-nav:active {
    transform: scale(0.95);
}

.bb-datepicker-current {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

/* Calendar Grid */
.bb-datepicker-body {
    padding: 20px;
}

.bb-datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 0;
    background: #f8f9fa;
    border-radius: 10px;
}

.bb-datepicker-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0;
}

.bb-datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.bb-datepicker-day {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #232323;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bb-datepicker-day:hover:not(.disabled):not(.other-month) {
    background: #f0edff;
    border-color: #e0daff;
    transform: scale(1.05);
}

.bb-datepicker-day.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    opacity: 0.5;
}

.bb-datepicker-day.other-month {
    color: #d1d5db;
    cursor: not-allowed;
}

.bb-datepicker-day.today {
    border-color: #4337ed;
    font-weight: 700;
}

.bb-datepicker-day.selected {
    background: linear-gradient(135deg, #4337ed 0%, #5a4dff 100%);
    color: #ffffff;
    font-weight: 600;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(67, 55, 237, 0.35);
}

.bb-datepicker-day.in-range {
    background: #f0edff;
    color: #4337ed;
    border-radius: 0;
}

/* Hover-Bereich während der Auswahl */
.bb-datepicker-day.hover-in-range {
    background: #e8e4ff;
    color: #4337ed;
    border-radius: 0;
    border-top: 2px dashed rgba(67, 55, 237, 0.3);
    border-bottom: 2px dashed rgba(67, 55, 237, 0.3);
    animation: pulseHover 1.5s ease-in-out infinite;
}

@keyframes pulseHover {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.bb-datepicker-day.range-start {
    background: linear-gradient(135deg, #4337ed 0%, #5a4dff 100%);
    color: #ffffff;
    border-radius: 12px 0 0 12px;
    font-weight: 600;
    transform: scale(1.05);
}

.bb-datepicker-day.range-end {
    background: linear-gradient(135deg, #4337ed 0%, #5a4dff 100%);
    color: #ffffff;
    border-radius: 0 12px 12px 0;
    font-weight: 600;
    transform: scale(1.05);
}

.bb-datepicker-day.range-start.range-end {
    border-radius: 12px;
}

/* Footer */
.bb-datepicker-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.bb-datepicker-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.bb-datepicker-btn-clear {
    background: #f3f4f6;
    color: #6b7280;
}

.bb-datepicker-btn-clear:hover {
    background: #e5e7eb;
}

.bb-datepicker-btn-apply {
    background: linear-gradient(135deg, #4337ed 0%, #5a4dff 100%);
    color: #ffffff;
}

.bb-datepicker-btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 55, 237, 0.35);
}

.bb-datepicker-btn-apply:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .bb-datepicker-calendar {
        position: fixed;
        left: 15px;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        margin-top: 0;
        max-width: calc(100vw - 30px);
        width: 100%;
    }
    
    .bb-datepicker-calendar.active {
        animation: fadeInScaleMobile 0.3s ease;
    }
    
    @keyframes fadeInScaleMobile {
        from {
            opacity: 0;
            transform: translateY(-50%) scale(0.9);
        }
        to {
            opacity: 1;
            transform: translateY(-50%) scale(1);
        }
    }
    
    .bb-datepicker-header {
        padding: 12px;
    }
    
    .bb-datepicker-current {
        font-size: 15px;
    }
    
    .bb-datepicker-nav {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .bb-datepicker-body {
        padding: 12px;
    }
    
    .bb-datepicker-weekdays {
        gap: 4px;
        padding: 8px 0;
    }
    
    .bb-datepicker-weekday {
        font-size: 10px;
        padding: 4px 0;
    }
    
    .bb-datepicker-days {
        gap: 4px;
    }
    
    .bb-datepicker-day {
        font-size: 12px;
    }
    
    .bb-datepicker-footer {
        padding: 10px 12px;
    }
    
    .bb-datepicker-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Overlay */
.bb-datepicker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1055;
    display: none;
}

.bb-datepicker-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Input Field Styling */
#dateRange {
    cursor: pointer;
    background-color: #ffffff;
}

#dateRange:focus {
    outline: none;
    box-shadow: none;
}

/* Modal Datepicker - Begrenzte Breite */
.modal .bb-datepicker-calendar {
    left: auto;
    right: auto;
    max-width: 360px;
    width: 100%;
}

/* Modal Datepicker - Mobile Anpassung */
@media (max-width: 768px) {
    .modal .bb-datepicker-calendar {
        max-width: calc(100vw - 30px);
        left: 15px;
        right: 15px;
    }
}

/* Kleinere Skalierung für Modal */
.modal .bb-datepicker-header {
    padding: 15px;
}

.modal .bb-datepicker-current {
    font-size: 16px;
}

.modal .bb-datepicker-nav {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.modal .bb-datepicker-body {
    padding: 15px;
}

.modal .bb-datepicker-weekday {
    font-size: 11px;
    padding: 6px 0;
}

.modal .bb-datepicker-day {
    font-size: 13px;
}

.modal .bb-datepicker-footer {
    padding: 12px 15px;
}

.modal .bb-datepicker-btn {
    padding: 8px 16px;
    font-size: 13px;
}
