﻿/* ============================================================
   SAMRA — Date Range Picker  |  drp.css
   يدعم AR + EN  |  RTL + LTR
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   SEARCH BAR — LIGHT THEME
   ══════════════════════════════════════════════════════════ */

.search-box {
    background: rgba(20, 15, 10, 0.92) !important;
}

[data-theme="light"] .search-box {
    background: rgba(255, 248, 238, 0.97) !important;
    border-color: rgba(156, 107, 46, 0.4) !important;
}

[data-theme="light"] .search-label {
    color: #1F2933 !important;
}

[data-theme="light"] .search-label-bar {
    border-color: #AD6029 !important;
}

[data-theme="light"] .search-field {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(156, 107, 46, 0.35) !important;
}

    [data-theme="light"] .search-field:focus-within {
        background: rgba(255, 255, 255, 0.95) !important;
    }

    [data-theme="light"] .search-field > svg {
        color: #9C6137 !important;
    }

    [data-theme="light"] .search-field select,
    [data-theme="light"] .search-field input {
        color: #1F2933 !important;
    }

        [data-theme="light"] .search-field select option {
            background: #fff8ee !important;
            color: #1F2933 !important;
        }

        [data-theme="light"] .search-field input::placeholder,
        [data-theme="light"] .search-field select:invalid {
            color: rgba(31, 41, 51, 0.5) !important;
        }

[data-theme="light"] .field-divider {
    background: rgba(156, 107, 46, 0.3) !important;
}

[data-theme="light"] .chevron-icon {
    color: #9C6137 !important;
}

/* ══════════════════════════════════════════════════════════
   DRP TRIGGER
   ══════════════════════════════════════════════════════════ */

.drp-wrap {
    position: relative;
    flex: 1.4 !important;
}

#drp-text {
    flex: 1;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    background: none;
    border: none;
    outline: none;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* placeholder في dark mode — ذهبي شفاف */
    color: rgba(200, 162, 122, 0.45);
    transition: color 0.2s;
    user-select: none;
}

    #drp-text[dir="rtl"] {
        text-align: right;
    }

    #drp-text[dir="ltr"] {
        text-align: left;
    }

    /* قيمة مختارة في dark mode */
    #drp-text.has-value {
        color: #D9D9D9;
    }

/* placeholder في light mode */
[data-theme="light"] #drp-text {
    color: rgba(31, 41, 51, 0.45);
}

    /* قيمة مختارة في light mode */
    [data-theme="light"] #drp-text.has-value {
        color: #1F2933;
    }

/* ══════════════════════════════════════════════════════════
   DRP POPUP — position: absolute (مش fixed)
   ══════════════════════════════════════════════════════════ */

.drp-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    z-index: 99999;
    background: rgba(20, 15, 10, 0.98);
    border: 1px solid var(--gold, #C8A27A);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.65);
    display: none;
    font-family: 'Tajawal', sans-serif;
    width: 280px;
    max-width: calc(100vw - 20px);
    transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

    .drp-popup.show {
        display: block;
        animation: drpFadeIn .2s ease both;
    }

    /* RTL — الـ popup يظهر من اليمين */
    .drp-popup[dir="rtl"] {
        right: 0;
        left: auto;
        direction: rtl;
    }

    /* LTR — الـ popup يظهر من اليسار */
    .drp-popup[dir="ltr"] {
        right: auto;
        left: 0;
        direction: ltr;
    }

[data-theme="light"] .drp-popup {
    background: rgba(255, 248, 238, 0.98);
    border-color: rgba(156, 107, 46, 0.35);
    box-shadow: 0 12px 48px rgba(60, 35, 10, 0.18);
}

@keyframes drpFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════════════════════════════════
   NAV BAR
   ══════════════════════════════════════════════════════════ */

.drp-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.drp-nav-spacer {
    flex: 1;
}

.drp-nav {
    background: rgba(200, 162, 122, 0.12);
    border: none;
    border-radius: 7px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gold, #C8A27A);
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

    /* #fff يشتغل في dark وlight على حد سواء */
    .drp-nav:hover {
        background: var(--gold, #C8A27A);
        color: #fff;
    }

[data-theme="light"] .drp-nav {
    color: #AD6029;
}

    [data-theme="light"] .drp-nav:hover {
        background: #AD6029;
        color: #fff;
    }

/* ══════════════════════════════════════════════════════════
   MONTH CONTAINER
   ══════════════════════════════════════════════════════════ */

.drp-months {
    width: 100%;
}

.drp-month {
    width: 100%;
}

.drp-cal-title {
    text-align: center;
    margin-bottom: 10px;
}

.drp-mname {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold, #C8A27A);
}

.drp-myear {
    font-size: 11px;
    color: rgba(200, 162, 122, 0.6);
}

[data-theme="light"] .drp-mname {
    color: #AD6029;
}

[data-theme="light"] .drp-myear {
    color: rgba(156, 107, 46, 0.55);
}

/* ══════════════════════════════════════════════════════════
   DAYS GRID
   ══════════════════════════════════════════════════════════ */

.drp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-top: 6px;
}

/* RTL — الأحد على اليمين */
.drp-popup[dir="rtl"] .drp-grid {
    direction: rtl;
}

/* LTR — الأحد على اليسار */
.drp-popup[dir="ltr"] .drp-grid {
    direction: ltr;
}

.drp-dow {
    text-align: center;
    font-size: 10px;
    color: rgba(200, 162, 122, 0.55);
    padding: 4px 0;
    font-weight: 600;
}

[data-theme="light"] .drp-dow {
    color: rgba(156, 107, 46, 0.5);
}

/* ══════════════════════════════════════════════════════════
   DAY CELLS
   ══════════════════════════════════════════════════════════ */

.drp-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    /* قيمة صريحة بدل var() غير معرَّف */
    color: #D9D9D9;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    position: relative;
    user-select: none;
}

    .drp-day:hover:not(.past):not(.empty) {
        background: rgba(200, 162, 122, 0.2);
    }

    .drp-day.empty {
        cursor: default;
        pointer-events: none;
    }

    .drp-day.past {
        color: rgba(200, 162, 122, 0.2);
        cursor: not-allowed;
        pointer-events: none;
    }

    .drp-day.today {
        color: var(--gold, #C8A27A);
        font-weight: 700;
    }

[data-theme="light"] .drp-day {
    color: #1F2933;
}

    [data-theme="light"] .drp-day:hover:not(.past):not(.empty) {
        background: rgba(156, 107, 46, 0.18);
    }

    [data-theme="light"] .drp-day.past {
        color: rgba(156, 107, 46, 0.2);
    }

    [data-theme="light"] .drp-day.today {
        color: #69452B;
        font-weight: 700;
    }

/* ══════════════════════════════════════════════════════════
   SELECTION — حسب اتجاه الـ popup
   ══════════════════════════════════════════════════════════ */

/* RTL: البداية على اليمين */
.drp-popup[dir="rtl"] .drp-day.sel-start {
    background: var(--gold-grad, linear-gradient(231.82deg, #69452B 27.99%, #CF8855 102.97%));
    color: #fff;
    font-weight: 700;
    border-radius: 0 6px 6px 0;
    z-index: 1;
}

.drp-popup[dir="rtl"] .drp-day.sel-end {
    background: var(--gold-grad, linear-gradient(231.82deg, #69452B 27.99%, #CF8855 102.97%));
    color: #fff;
    font-weight: 700;
    border-radius: 6px 0 0 6px;
    z-index: 1;
}

.drp-popup[dir="rtl"] .drp-day.sel-start.sel-end {
    border-radius: 6px;
}

/* LTR: البداية على اليسار */
.drp-popup[dir="ltr"] .drp-day.sel-start {
    background: var(--gold-grad, linear-gradient(231.82deg, #69452B 27.99%, #CF8855 102.97%));
    color: #fff;
    font-weight: 700;
    border-radius: 6px 0 0 6px;
    z-index: 1;
}

.drp-popup[dir="ltr"] .drp-day.sel-end {
    background: var(--gold-grad, linear-gradient(231.82deg, #69452B 27.99%, #CF8855 102.97%));
    color: #fff;
    font-weight: 700;
    border-radius: 0 6px 6px 0;
    z-index: 1;
}

.drp-popup[dir="ltr"] .drp-day.sel-start.sel-end {
    border-radius: 6px;
}

/* ══════════════════════════════════════════════════════════
   RANGE
   ══════════════════════════════════════════════════════════ */

.drp-day.in-range {
    background: rgba(200, 162, 122, 0.14);
    border-radius: 0;
    /* قيمة صريحة بدل var() */
    color: #D9D9D9;
}

[data-theme="light"] .drp-day.in-range {
    background: rgba(156, 107, 46, 0.1);
    color: #1F2933;
}

/* ══════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════ */

.drp-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(200, 162, 122, 0.2);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

[data-theme="light"] .drp-footer {
    border-top-color: rgba(156, 107, 46, 0.2);
}

.drp-summary {
    font-size: 12px;
    color: rgba(200, 162, 122, 0.85);
    font-family: 'Tajawal', sans-serif;
    flex: 1;
}

[data-theme="light"] .drp-summary {
    /* أغمق لوضوح أفضل على الخلفية الفاتحة */
    color: #69452B;
}

.drp-clear {
    background: transparent;
    border: 1px solid rgba(200, 162, 122, 0.3);
    border-radius: 7px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--gold, #C8A27A);
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    transition: background 0.2s;
}

    .drp-clear:hover {
        background: rgba(200, 162, 122, 0.12);
    }

[data-theme="light"] .drp-clear {
    border-color: rgba(156, 107, 46, 0.35);
    color: #69452B;
}

    [data-theme="light"] .drp-clear:hover {
        background: rgba(156, 107, 46, 0.08);
    }

/* ══════════════════════════════════════════════════════════
   MOBILE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .drp-popup,
    .drp-popup[dir="rtl"],
    .drp-popup[dir="ltr"] {
        right: 0;
        left: 0;
        width: 100%;
        max-width: none;
    }
}
/* ══ LOCKED DAYS — أيام محجوزة من الـ API ══ */
.drp-day.locked {
    background: rgba(220, 53, 69, 0.10);
    color: rgba(220, 53, 69, 0.50);
    cursor: not-allowed;
    pointer-events: none;
    text-decoration: line-through;
    text-decoration-color: rgba(220, 53, 69, 0.35);
    position: relative;
}

    .drp-day.locked::before {
        content: '';
        position: absolute;
        inset: 3px;
        border-radius: 4px;
        border: 1px solid rgba(220, 53, 69, 0.20);
    }

[data-theme="light"] .drp-day.locked {
    background: rgba(220, 53, 69, 0.07);
    color: rgba(185, 28, 28, 0.45);
}

    [data-theme="light"] .drp-day.locked::before {
        border-color: rgba(185, 28, 28, 0.18);
    }