/**
 * Date Range Picker Modal Styling
 * Shared modal component used by FilterDatePicker
 * Note: FilterDatePicker trigger styles are in filter-date-picker.css
 */

/* ==================== DATE PICKER MODAL ==================== */
.date-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.date-picker-container {
    position: relative;
    border: 1px solid #dddfe0;
    border-radius: 1.25rem;
    background-image: url("../../images/bg_noise.webp"), linear-gradient(180deg, #f8f8f7, #f1f0ee);
    background-position: 0 0, 0 0;
    background-size: auto, auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 1);
    width: 820px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Date Picker Header */
.date-picker-header {
    padding: 16px 20px;
    border-bottom: 1px solid #dddfe0;
    background: transparent;
}

.date-range-inputs {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.date-input-group {
    flex: 1;
}

.date-input-group label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-picker-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    background: #f8f9fa;
    color: #2c3e50;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.date-picker-input:focus {
    outline: none;
    border-color: #36a4b5;
}

/* Date Presets */
.date-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: #2d8998;
    color: #2d8998;
    background: #f0f7ff;
}

.preset-btn.active {
    background: #e0f2f7;
    border-color: #2d8998;
    color: #105c74;
}

/* Calendar Panels */
.date-picker-calendars {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.calendar-panel {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #dddfe0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-nav {
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #4a5568;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav:hover {
    background: #f3f4f6;
    border-color: #2d8998;
    color: #2d8998;
}

.calendar-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

/* Grid layouts for months and years */
.calendar-grid:has(.calendar-month) {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.calendar-grid:has(.calendar-year) {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.calendar-day-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #2c3e50;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.calendar-day.disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

.calendar-day.disabled:hover {
    background: transparent;
    border-color: transparent;
}

.calendar-day.other-month {
    color: #9ca3af;
}

.calendar-day.selected {
    background: #2d8998;
    color: white;
    font-weight: 600;
}

.calendar-day.in-range {
    background: #e0f2f7;
    color: #2d8998;
}

.calendar-day.in-range-forward {
    background: rgba(224, 242, 247, 0.5);
    color: #2d8998;
}

.calendar-day.in-range-backward {
    background: rgba(224, 242, 247, 0.5);
    color: #2d8998;
}

.calendar-day.range-start,
.calendar-day.range-end {
    background: #2d8998;
    color: white;
    font-weight: 600;
}

.calendar-day.today {
    border-color: #2d8998;
    font-weight: 600;
}

/* Month and Year Selection Styles */
.calendar-month,
.calendar-year {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #2c3e50;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-weight: 500;
    padding: 16px 8px;
}

.calendar-month:hover,
.calendar-year:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.calendar-month.selected,
.calendar-year.selected {
    background: #2d8998;
    color: white;
    font-weight: 600;
}

.calendar-month.in-range,
.calendar-year.in-range {
    background: #e0f2f7;
    color: #2d8998;
}

.calendar-month.in-range-forward,
.calendar-year.in-range-forward {
    background: rgba(224, 242, 247, 0.5);
    color: #2d8998;
}

.calendar-month.in-range-backward,
.calendar-year.in-range-backward {
    background: rgba(224, 242, 247, 0.5);
    color: #2d8998;
}

.calendar-month.range-start,
.calendar-month.range-end,
.calendar-year.range-start,
.calendar-year.range-end {
    background: #2d8998;
    color: white;
    font-weight: 600;
}

/* Date Picker Footer */
.date-picker-footer {
    padding: 16px 20px;
    border-top: 1px solid #dddfe0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: transparent;
}

.date-picker-cancel,
.date-picker-apply {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-picker-cancel {
    background: #e5e7eb;
    color: #4a5568;
    border: 1px solid #dddfe0;
}

.date-picker-cancel:hover {
    background: #d1d5db;
    transform: translateY(-1px);
}

.date-picker-apply {
    background: #105c74;
    color: white;
}

.date-picker-apply:hover {
    background: #0d4a5c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 92, 116, 0.4);
}

/* ==================== DARK MODE ==================== */

@media (prefers-color-scheme: dark) {
    .date-picker-container {
        background-image: url("../../images/bg_noise.webp"), linear-gradient(180deg, #1a1d20, #0f1113);
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    }

    .date-picker-header {
        background: transparent;
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }

    .date-input-group label {
        color: #9ca3af;
    }

    .date-picker-input {
        background: #0f1113;
        border-color: rgba(255, 255, 255, 0.12);
        color: #e5e7eb;
    }

    .preset-btn {
        background: #0f1113;
        border-color: rgba(255, 255, 255, 0.12);
        color: #9ca3af;
    }

    .preset-btn:hover {
        border-color: #2d8998;
        color: #4fb3c5;
    }

    .preset-btn.active {
        background: rgba(45, 137, 152, 0.2);
        border-color: #2d8998;
        color: #4fb3c5;
    }

    .calendar-panel {
        background: #1a1d20;
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    }

    .calendar-nav {
        background: #0f1113;
        border-color: rgba(255, 255, 255, 0.12);
        color: #9ca3af;
    }

    .calendar-nav:hover {
        background: #2a2d30;
        border-color: #2d8998;
        color: #4fb3c5;
    }

    .calendar-title {
        color: #e5e7eb;
    }

    .calendar-day-header {
        color: #9ca3af;
    }

    .calendar-day {
        color: #e5e7eb;
    }

    .calendar-day:hover {
        background: #2a2d30;
        border-color: rgba(255, 255, 255, 0.12);
    }

    .calendar-day.disabled {
        color: #4a4d50;
    }

    .calendar-day.other-month {
        color: #6b7280;
    }

    .calendar-day.in-range {
        background: rgba(45, 137, 152, 0.2);
        color: #4fb3c5;
    }

    .calendar-day.in-range-forward {
        background: rgba(45, 137, 152, 0.1);
        color: #4fb3c5;
    }

    .calendar-day.in-range-backward {
        background: rgba(45, 137, 152, 0.1);
        color: #4fb3c5;
    }

    .calendar-month,
    .calendar-year {
        color: #e5e7eb;
    }

    .calendar-month:hover,
    .calendar-year:hover {
        background: #2a2d30;
        border-color: rgba(255, 255, 255, 0.12);
    }

    .calendar-month.selected,
    .calendar-year.selected {
        background: #2d8998;
        color: white;
    }

    .calendar-month.in-range,
    .calendar-year.in-range {
        background: rgba(45, 137, 152, 0.2);
        color: #4fb3c5;
    }

    .calendar-month.in-range-forward,
    .calendar-year.in-range-forward {
        background: rgba(45, 137, 152, 0.1);
        color: #4fb3c5;
    }

    .calendar-month.in-range-backward,
    .calendar-year.in-range-backward {
        background: rgba(45, 137, 152, 0.1);
        color: #4fb3c5;
    }

    .calendar-month.range-start,
    .calendar-month.range-end,
    .calendar-year.range-start,
    .calendar-year.range-end {
        background: #2d8998;
        color: white;
    }

    .date-picker-footer {
        background: transparent;
        border-top-color: rgba(255, 255, 255, 0.12);
    }

    .date-picker-cancel {
        background: #2a2d30;
        color: #e5e7eb;
        border-color: rgba(255, 255, 255, 0.12);
    }

    .date-picker-cancel:hover {
        background: #3a3d40;
        transform: translateY(-1px);
    }

    .date-picker-apply {
        background: #105c74;
        color: white;
    }

    .date-picker-apply:hover {
        background: #0d4a5c;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(16, 92, 116, 0.4);
    }
}

/* ==================== TIME PICKER INTEGRATION ==================== */

.date-time-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}

.time-picker-input {
    width: 100px;
    padding: 12px 14px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    background: #f8f9fa;
    color: #2c3e50;
    transition: border-color 0.2s ease;
    text-align: center;
    cursor: pointer;
}

.dp-time-picker-input:focus {
    outline: none;
    border-color: #36a4b5;
}

.dp-time-picker-panel {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #dddfe0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

.dp-time-picker-container-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.dp-time-picker-header-inline {
    margin-bottom: 20px;
}

.dp-time-picker-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
}

.dp-time-display-value {
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.dp-time-display-value:hover {
    background: #f3f4f6;
}

.dp-time-display-value.active {
    color: #2d8998;
    background: #e0f2f7;
}

.dp-time-display-separator {
    color: #9ca3af;
    padding-bottom: 4px;
}

.dp-time-picker-body {
    position: relative;
    width: 220px;
    height: 220px;
    margin-bottom: 16px;
    overflow: hidden;
}

.dp-clock-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #f8f9fa;
    position: relative;
    cursor: pointer;
}

.dp-clock-center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #2d8998;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.dp-clock-hand {
    position: absolute;
    left: calc(50% - 1px);
    width: 2px;
    background: #2d8998;
    transform-origin: bottom center;
    z-index: 5;
    pointer-events: none;
}

.dp-clock-hand::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    width: 24px;
    height: 24px;
    background: transparent;
    border: 2px solid #2d8998;
    border-radius: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
}

.dp-clock-number {
    position: absolute;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #4a5568;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.2s;
    z-index: 6;
    line-height: 28px;
}

.dp-clock-number.small {
    font-size: 11px;
    color: #718096;
}

.dp-clock-number.selected {
    background: #2d8998;
    color: white;
    font-weight: 600;
}

.dp-time-picker-footer-inline {
    width: 100%;
    display: flex;
    justify-content: center;
}

.dp-time-picker-done-btn {
    padding: 8px 24px;
    background: #105c74;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dp-time-picker-done-btn:hover {
    background: #0d4a5c;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 92, 116, 0.2);
}

/* Dark Mode for Time Picker */
@media (prefers-color-scheme: dark) {
    .dp-time-picker-input {
        background: #0f1113;
        border-color: rgba(255, 255, 255, 0.12);
        color: #e5e7eb;
    }

    .dp-time-picker-panel {
        background: #1a1d20;
        border-color: #2d3748;
    }

    .dp-time-picker-display {
        color: #e2e8f0;
    }

    .dp-time-display-value:hover {
        background: #2d3748;
    }

    .dp-time-display-value.active {
        color: #4fd1c5;
        background: rgba(79, 209, 197, 0.1);
    }

    .dp-clock-face {
        background: #2d3748;
    }

    .dp-clock-number {
        color: #cbd5e0;
    }

    .dp-clock-number.small {
        color: #a0aec0;
    }

    .dp-clock-number.selected {
        color: #1a202c;
        background: #4fd1c5;
    }

    .dp-clock-center-dot,
    .dp-clock-hand {
        background: #4fd1c5;
    }

    .dp-clock-hand::before {
        border-color: #4fd1c5;
    }

    .dp-time-picker-done-btn {
        background: #4fd1c5;
        color: #1a202c;
    }

    .dp-time-picker-done-btn:hover {
        background: #38b2ac;
    }
}