/* ============================================================
   Fancy DatePicker — modern calendar component
   Progressively enhances <input type="date|datetime-local|time|month">
   Brand: primary-blue #211594 · primary-green #26c221
   ============================================================ */

.fdp-wrap { position: relative; width: 100%; font-family: inherit; }

.fdp-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #1f2937;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    text-align: left;
    user-select: none;
}
.fdp-trigger:hover:not(:disabled) { border-color: #c7c9d6; }
.fdp-trigger:focus,
.fdp-wrap.fdp-open .fdp-trigger {
    outline: none;
    border-color: #211594;
    box-shadow: 0 0 0 3px rgba(33,21,148,.12);
}
.fdp-trigger[disabled] { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }

.fdp-icon { width: 18px; height: 18px; color: #211594; flex-shrink: 0; }
.fdp-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdp-value.fdp-placeholder { color: #9ca3af; }
.fdp-clear {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background .15s, color .15s;
}
.fdp-clear:hover { background: #fee2e2; color: #dc2626; }

/* Calendar panel */
.fdp-panel {
    position: absolute;
    z-index: 1000;
    left: 0;
    margin-top: 8px;
    width: 320px;
    max-width: 95vw;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(15,23,42,.15), 0 4px 16px rgba(15,23,42,.08);
    display: none;
    overflow: hidden;
    animation: fdp-fade .15s ease-out;
}
.fdp-wrap.fdp-open .fdp-panel { display: block; }
.fdp-wrap.fdp-up .fdp-panel { bottom: 100%; top: auto; margin-top: 0; margin-bottom: 8px; }
.fdp-wrap.fdp-right .fdp-panel { left: auto; right: 0; }

@keyframes fdp-fade {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header with month/year and nav */
.fdp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #211594, #2a1ab8);
    color: #fff;
}
.fdp-nav-btn {
    width: 30px; height: 30px;
    background: rgba(255,255,255,.12);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    padding: 0;
}
.fdp-nav-btn:hover { background: rgba(255,255,255,.22); }
.fdp-nav-btn svg { width: 16px; height: 16px; }

.fdp-title {
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background .15s;
    user-select: none;
}
.fdp-title:hover { background: rgba(255,255,255,.12); }

/* Weekday labels */
.fdp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 10px 12px 4px;
    gap: 2px;
}
.fdp-wd {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 6px 0;
}

/* Day grid */
.fdp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 0 12px 12px;
    gap: 2px;
}
.fdp-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
    transition: background .12s, color .12s, transform .05s;
    padding: 0;
    font-weight: 500;
    font-family: inherit;
    position: relative;
}
.fdp-day:hover:not(:disabled) { background: #f3f4ff; color: #211594; }
.fdp-day:active:not(:disabled) { transform: scale(.92); }
.fdp-day.fdp-other { color: #d1d5db; }
.fdp-day.fdp-today {
    color: #26c221;
    font-weight: 700;
}
.fdp-day.fdp-today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #26c221;
}
.fdp-day.fdp-selected {
    background: #211594;
    color: #fff;
    font-weight: 700;
}
.fdp-day.fdp-selected::after { background: #fff; }
.fdp-day.fdp-selected:hover { background: #1a1077; color: #fff; }
.fdp-day:disabled {
    opacity: .35;
    cursor: not-allowed;
    color: #d1d5db;
}

/* Month/Year picker grid (when title clicked) */
.fdp-mygrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 16px;
}
.fdp-mybtn {
    padding: 12px 8px;
    background: #f9fafb;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
}
.fdp-mybtn:hover { background: #f3f4ff; color: #211594; border-color: #d6d3ff; }
.fdp-mybtn.fdp-current { background: #211594; color: #fff; border-color: #211594; }
.fdp-mybtn:disabled { opacity: .35; cursor: not-allowed; }

/* Footer with quick actions */
.fdp-footer {
    display: flex;
    gap: 6px;
    padding: 8px 12px 12px;
    border-top: 1px solid #f3f4f6;
}
.fdp-quick {
    flex: 1;
    padding: 8px 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
}
.fdp-quick:hover { background: #211594; color: #fff; border-color: #211594; }

/* Time-picker section (datetime-local) */
.fdp-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
}
.fdp-time-input {
    width: 56px;
    padding: 8px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #211594;
    font-family: inherit;
    -moz-appearance: textfield;
    appearance: textfield;
}
.fdp-time-input::-webkit-outer-spin-button,
.fdp-time-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fdp-time-input:focus {
    outline: none;
    border-color: #211594;
    box-shadow: 0 0 0 3px rgba(33,21,148,.1);
}
.fdp-time-sep { font-weight: 700; color: #6b7280; }

/* Hide native input but keep accessible */
.fdp-native {
    position: absolute !important;
    width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0,0,0,0) !important;
    white-space: nowrap !important; border: 0 !important;
    opacity: 0 !important; pointer-events: none;
}

/* Mobile */
@media (max-width: 640px) {
    .fdp-panel { width: 300px; }
    .fdp-trigger { padding: 13px 14px; font-size: 15px; }
    .fdp-day { font-size: 14px; }
}
