/*!
 * AlbattarDatepicker — styles
 * All rules prefixed with .adp- to avoid collisions.
 */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* ---------------- Overlay & Popup ---------------- */
.adp-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    background: transparent;
}

.adp-popup {
    position: absolute;
    z-index: 1000;
    display: none;
    width: 380px;
    max-width: calc(100vw - 20px);
    padding: 20px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: #1F2937;
    direction: rtl;
    box-sizing: border-box;
}
.adp-popup, .adp-popup * { box-sizing: border-box; }

.adp-popup.adp-anim { animation: adpFadeIn 0.15s ease-out; }

@keyframes adpFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Header (title + arrows) ---------------- */
.adp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 12px;
}

.adp-title {
    flex: 1 1 auto;
    min-width: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    color: #1F2937;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.15s;
    text-align: center;
}
.adp-title:hover { background: #F1F5F9; }
.adp-title:focus { outline: none; background: #F1F5F9; }

.adp-nav {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    border-radius: 50%;
    cursor: pointer;
    color: #94A3B8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.adp-nav:hover,
.adp-nav:focus { background: #F1F5F9; color: #1F4E79; outline: none; }
.adp-nav svg { display: block; }

/* ---------------- Weekdays row ---------------- */
.adp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}
.adp-wd {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #1F4E79;
}

/* ---------------- Days grid ---------------- */
.adp-grid-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.adp-day {
    justify-self: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0 solid transparent;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    color: #1F2937;
    transition: background 0.15s, color 0.15s;
}
.adp-day:hover { background: #F1F5F9; }
.adp-day:focus { outline: none; background: #F1F5F9; }
.adp-day-other { color: #CBD5E1; }
.adp-day-today {
    font-weight: 700;
    color: #1F4E79;
    border: 2px solid #D4A853;
}
.adp-day-today:hover { background: #FEF3E0; }
.adp-day-selected,
.adp-day-selected:hover,
.adp-day-selected:focus {
    background: #1F4E79 !important;
    color: #FFFFFF !important;
    border-color: #1F4E79 !important;
}

/* ---------------- Months grid ---------------- */
.adp-grid-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.adp-month {
    padding: 14px 10px;
    min-height: 48px;
    border: none;
    background: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    color: #1F2937;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    transition: background 0.15s, color 0.15s;
}
.adp-month:hover { background: #F1F5F9; }
.adp-month:focus { outline: none; background: #F1F5F9; }
.adp-month.adp-current {
    background: #1F4E79 !important;
    color: #FFFFFF !important;
}

/* ---------------- Years grid ---------------- */
.adp-grid-years {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.adp-year {
    padding: 14px 10px;
    min-height: 48px;
    border: none;
    background: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    color: #1F2937;
    transition: background 0.15s, color 0.15s;
}
.adp-year:hover { background: #F1F5F9; }
.adp-year:focus { outline: none; background: #F1F5F9; }
.adp-year.adp-current {
    background: #1F4E79 !important;
    color: #FFFFFF !important;
}

/* ---------------- Footer (Today button) ---------------- */
.adp-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #F1F5F9;
    text-align: center;
}
.adp-today {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    color: #1F4E79;
    padding: 8px 20px;
    border-radius: 8px;
    transition: background 0.15s;
}
.adp-today:hover { background: #F1F5F9; }
.adp-today:focus { outline: none; background: #F1F5F9; }

/* ---------------- Display input (readonly, shown instead of original) ---------------- */
input.adp-display {
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%231F4E79' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 40px;
}
[dir="ltr"] input.adp-display {
    background-position: right 12px center;
    padding-right: 40px;
    padding-left: inherit;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 420px) {
    .adp-popup { width: calc(100vw - 20px); padding: 16px; }
    .adp-title { font-size: 17px; }
    .adp-day { width: 36px; height: 36px; font-size: 15px; }
    .adp-wd  { height: 28px; font-size: 12px; }
    .adp-month, .adp-year { padding: 12px 8px; min-height: 44px; font-size: 14px; }
    .adp-today { font-size: 13px; padding: 7px 16px; }
}
