/* ============================================================================
   OPX 6.0 Custom Date Picker
   Self-contained popup calendar with year-grid, month-grid, and day views.
   z-index: 10100 (above header-notification-popup at 10001, modal at 10000)
   ============================================================================ */

/* --------------------------------------------------------------------------
   Popup container
   -------------------------------------------------------------------------- */
.opx-dp {
    position: fixed;
    z-index: 10100;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.14);
    width: 280px;
    user-select: none;
    -webkit-user-select: none;
    font-family: "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    color: #262626;
    overflow: hidden;
    /* Entry animation */
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.opx-dp.opx-dp-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Header (shared across all views)
   -------------------------------------------------------------------------- */
.opx-dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid #f5f5f5;
}

.opx-dp-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #525252;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    flex-shrink: 0;
    /* Safari: stop the UA push-button appearance from painting over the
       transparent background / grey icon colour */
    -webkit-appearance: none;
    appearance: none;
}

.opx-dp-nav-btn:hover {
    background: #f5f5f5;
    color: #171717;
}

.opx-dp-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.opx-dp-nav-btn svg {
    /* Explicit size is required for Safari: the inline SVGs carry only a
       viewBox, and unsized SVGs get the 300x150 default replaced size there —
       clipped inside the 28px button, the grey chevron never shows. Chrome
       happens to shrink them to the flex container, masking the problem. */
    width: 16px;
    height: 16px;
    display: block;
    pointer-events: none;
}

.opx-dp-title-btn {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    color: #171717;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
    font-family: inherit;
}

.opx-dp-title-btn:hover {
    background: #f5f5f5;
}

/* --------------------------------------------------------------------------
   Day view
   -------------------------------------------------------------------------- */
.opx-dp-days-body {
    padding: 8px 10px 10px;
}

.opx-dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
}

.opx-dp-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #a3a3a3;
    padding: 4px 0;
    text-transform: uppercase;
}

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

.opx-dp-day {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #262626;
    transition: background 0.12s, color 0.12s;
    border: none;
    background: transparent;
    padding: 0;
    font-family: inherit;
}

.opx-dp-day:hover:not(.opx-dp-day-other):not(.opx-dp-day-disabled):not(.opx-dp-day-selected) {
    background: #fff7e6;
    color: #b45309;
}

.opx-dp-day-other {
    color: #d4d4d4;
    cursor: default;
}

.opx-dp-day-today {
    font-weight: 700;
    color: #d97706;
}

.opx-dp-day-selected {
    background: #ffac00 !important;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 6px;
}

.opx-dp-day-disabled {
    color: #d4d4d4;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Month grid view (3 columns x 4 rows)
   -------------------------------------------------------------------------- */
.opx-dp-months-body {
    padding: 10px 12px 12px;
}

.opx-dp-months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.opx-dp-month-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #262626;
    border: none;
    background: transparent;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
    font-weight: 400;
}

.opx-dp-month-cell:hover:not(.opx-dp-month-selected) {
    background: #fff7e6;
    color: #b45309;
}

.opx-dp-month-selected {
    background: #ffac00 !important;
    color: #ffffff !important;
    font-weight: 600;
}

.opx-dp-month-current {
    font-weight: 700;
    color: #d97706;
}

/* --------------------------------------------------------------------------
   Year grid view (3 columns, paged)
   -------------------------------------------------------------------------- */
.opx-dp-years-body {
    padding: 10px 12px 12px;
}

.opx-dp-years-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.opx-dp-year-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #262626;
    border: none;
    background: transparent;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
    font-weight: 400;
}

.opx-dp-year-cell:hover:not(.opx-dp-year-selected) {
    background: #fff7e6;
    color: #b45309;
}

.opx-dp-year-selected {
    background: #ffac00 !important;
    color: #ffffff !important;
    font-weight: 600;
}

.opx-dp-year-current {
    font-weight: 700;
    color: #d97706;
}

/* Year page range label in header */
.opx-dp-year-range {
    font-size: 13px;
    font-weight: 600;
    color: #171717;
}

/* --------------------------------------------------------------------------
   Footer / Today button
   -------------------------------------------------------------------------- */
.opx-dp-footer {
    border-top: 1px solid #f5f5f5;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.opx-dp-today-btn {
    font-size: 13px;
    font-weight: 500;
    color: #d97706;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    font-family: inherit;
}

.opx-dp-today-btn:hover {
    background: #fff7e6;
}

.opx-dp-clear-btn {
    font-size: 13px;
    font-weight: 500;
    color: #737373;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    font-family: inherit;
}

.opx-dp-clear-btn:hover {
    background: #f5f5f5;
}

/* --------------------------------------------------------------------------
   Trigger icon overlay on the input
   Lucide calendar icon replaces any native calendar icon
   -------------------------------------------------------------------------- */
.opx-dp-trigger-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.opx-dp-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    pointer-events: none;
    color: #737373;
}

/* Remove the native calendar-picker icon on Webkit/Blink entirely —
   an invisible (opacity:0) icon still opens the native popup on click */
.opx-dp-input::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

/* Wrapper around each attached input (added by attachPicker; helper.js uses
   the same wrapper for its display overlay). Must be a block box — inline
   wrappers are transparent to hit-testing once the input has
   pointer-events:none, and clicks would fall through to the page. */
.opx-dp-wrap {
    position: relative;
    display: block;
}

/* The definitive native-picker kill switch: attached inputs receive no
   pointer events at all, so no browser can open its own calendar from a
   click/tap. Clicks land on the .date-field-wrapper / .date-input-wrapper
   around the input (added by helper.js), where opx6-datepicker.js opens
   the custom popup via a delegated handler. Keyboard focus still works. */
input.opx-dp-input {
    pointer-events: none;
}

/* Ensure Firefox date inputs look consistent */
.opx-dp-input::-moz-focus-inner {
    border: 0;
}

/* --------------------------------------------------------------------------
   Responsive: constrain popup on very small screens
   -------------------------------------------------------------------------- */
@media (max-width: 320px) {
    .opx-dp {
        width: 260px;
    }
}
