/* Dual Datepicker Styles */
:root {
    --dp-bg: rgba(255, 255, 255, 0.85);
    --dp-border: rgba(255, 255, 255, 0.3);
    --dp-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --dp-accent: #6366f1;
    --dp-primary-text: #1e293b;
    --dp-holiday-bg: #fef2f2;
    --dp-holiday-text: #b91c1c; /* Darker red */
    --dp-today-bg: rgba(99, 102, 241, 0.1);
    --dp-today-border: #6366f1;
    --dp-radius: 1rem;
}

.ndp__datepicker {
    width: 280px; /* Further reduced from 320px */
    background: var(--dp-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--dp-border);
    border-radius: 0.75rem; /* Slightly tighter radius */
    box-shadow: var(--dp-shadow);
    padding: 0.75rem; /* Reduced from 1rem */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--dp-primary-text);
    user-select: none;
    z-index: 9999;
    /* Isolation: prevent host-page styles from leaking in */
    box-sizing: border-box;
    line-height: 1.2;
    font-size: 14px;
}

/* Ensure all nested elements inherit border-box */
.ndp__datepicker *,
.ndp__datepicker *::before,
.ndp__datepicker *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Modal/Popup specific styles */
.ndp__datepicker.popup {
    position: absolute;
    display: none;
    opacity: 0;
    transform: translateY(5px); /* Reduced from 10px */
}

.ndp__datepicker.popup.visible {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

.ndp__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem; /* Reduced from 1rem */
}

.ndp__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ndp__selectors {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ndp__month-select,
.ndp__year-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.4rem;
    padding: 0.25rem 1.2rem 0.25rem 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--dp-primary-text);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236366f1'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.35rem center;
    background-size: 8px;
}

.ndp__month-select:hover,
.ndp__year-select:hover {
    border-color: var(--dp-accent);
    background-color: rgba(99, 102, 241, 0.06);
}

.ndp__month-select:focus,
.ndp__year-select:focus {
    outline: none;
    border-color: var(--dp-accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.ndp__month-select {
    min-width: 5.5rem;
}

.ndp__year-select {
    min-width: 4.5rem;
}

/* Dark mode dropdown styles */
.dark .ndp__month-select,
.dark .ndp__year-select {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23818cf8'/%3E%3C/svg%3E");
}

.dark .ndp__month-select:hover,
.dark .ndp__year-select:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(129, 140, 248, 0.5);
}

.dark .ndp__month-select:focus,
.dark .ndp__year-select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
}

.dark .ndp__month-select option,
.dark .ndp__year-select option {
    background: #1e293b;
    color: #e2e8f0;
}

.ndp__title .ndp__header-ad {
    margin: 0;
    font-size: 0.65rem; /* Reduced from 0.75rem */
    color: var(--dp-secondary-text);
    font-weight: 500;
}

.ndp__nav {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 0.4rem;
    padding: 0.25rem 0.5rem; /* Tighter buttons */
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.ndp__nav:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ndp__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px; /* Reduced from 0.5rem */
    margin-bottom: 0.25rem;
}

.ndp__weekdays span {
    text-align: center;
    font-size: 0.65rem; /* Reduced */
    font-weight: 600;
    color: var(--dp-secondary-text);
    text-transform: uppercase;
}

.ndp__weekdays .ndp__holiday-header,
.ndp__weekdays span:nth-child(7) {
    color: var(--dp-holiday-text) !important;
}

.dark .ndp__weekdays .ndp__holiday-header,
.dark .ndp__weekdays span:nth-child(7) {
    color: #f87171 !important;
}

.ndp__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.ndp__day {
    min-height: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
    padding: 2px 1px;
    overflow: hidden;
    line-height: 1;
}

.ndp__day:not(.empty):hover {
    background: var(--dp-accent);
    color: white;
}

.ndp__day:not(.empty):hover .ndp__ad-date {
    color: rgba(255, 255, 255, 0.9);
}

.ndp__bs-date {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.ndp__ad-date {
    font-size: 0.55rem;
    color: var(--dp-secondary-text);
    margin-top: 1px;
    line-height: 1;
    white-space: nowrap;
}

.ndp__day.today {
    background: var(--dp-today-bg);
    border-color: var(--dp-today-border);
}

.ndp__day.holiday,
.ndp__day:not(.empty):nth-child(7n) {
    background: var(--dp-holiday-bg);
    color: var(--dp-holiday-text) !important;
}

.ndp__day.holiday .ndp__ad-date,
.ndp__day:not(.empty):nth-child(7n) .ndp__ad-date {
    color: var(--dp-holiday-text);
    opacity: 0.8;
}

.dark .ndp__day.holiday,
.dark .ndp__day:not(.empty):nth-child(7n) {
    background: rgba(185, 28, 28, 0.15);
    color: #f87171 !important;
    border: 1px solid rgba(185, 28, 28, 0.3);
}

.dark .ndp__day.holiday .ndp__ad-date,
.dark .ndp__day:not(.empty):nth-child(7n) .ndp__ad-date {
    color: #f87171;
}

.ndp__day.empty {
    cursor: default;
}

/* Scrollbar styling */
.ndp__days::-webkit-scrollbar {
    width: 4px;
}

.ndp__days::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}
