/*
 * app-dp � Custom Date-Time Picker (no library)
 * ================================================
 * Uses Inter font (inherit from Filament).
 * Sharp (no rounded) corners as requested.
 * Royal Blue #2563eb as primary.
 */

/* ----------------------------------------
   INPUT TRIGGER
   ---------------------------------------- */

.app-dp-wrap {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.app-dp-input {
    display: inline-grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.34rem 0.5rem;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 0.6rem;
    cursor: pointer;
    user-select: none;
    min-width: 235px;
    min-height: 42px;
    transition: border-color 0.18s, box-shadow 0.18s, background-color 0.18s;
}

.app-dp-input--no-icon {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    padding-left: 0.65rem;
}

.app-dp-input:hover { border-color: #2563eb; }

.app-dp-input--active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.dark .app-dp-input { background: #1e293b; border-color: #334155; color: #f1f5f9; }
.dark .app-dp-input:hover,
.dark .app-dp-input--active { border-color: #3b82f6; }

.app-dp-input-icon-box,
.app-dp-input-caret-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    flex-shrink: 0;
}

.app-dp-input-icon-box {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 0.45rem;
}

.dark .app-dp-input-icon-box {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
}

.app-dp-input-text-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
}

.app-dp-input-icon {
    width: 0.95rem;
    height: 0.95rem;
    color: #2563eb;
    flex-shrink: 0;
}

.dark .app-dp-input-icon { color: #60a5fa; }

.app-dp-input-text {
    font-size: 0.83rem;
    font-weight: 600;
    color: #111827;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.dark .app-dp-input-text { color: #f1f5f9; }
.app-dp-placeholder { color: #9ca3af !important; font-weight: 400 !important; }
.dark .app-dp-placeholder { color: #475569 !important; }

.app-dp-input-caret-box {
    color: #6b7280;
}

.dark .app-dp-input-caret-box {
    color: #94a3b8;
}

.app-dp-input-caret {
    width: 0.78rem;
    height: 0.78rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.app-dp-caret-open { transform: rotate(180deg); }

/* ----------------------------------------
   DIALOG
   ---------------------------------------- */

.app-dp-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(2px);
}

.dark .app-dp-modal {
    background: rgba(2, 6, 23, 0.62);
}

.app-dp-dialog {
    position: relative;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    box-shadow: 0 20px 48px rgba(0,0,0,0.14), 0 6px 16px rgba(0,0,0,0.07);
    min-width: 300px;
    width: min(96vw, 620px);
    max-height: min(92vh, 760px);
    border-radius: 0.8rem;
    overflow: hidden;
}

.dark .app-dp-dialog {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 24px 60px rgba(0,0,0,0.65);
}

.app-dp-enter      { transition: opacity 0.15s ease, transform 0.15s ease; }
.app-dp-enter-start { opacity: 0; transform: translateY(-6px); }
.app-dp-enter-end   { opacity: 1; transform: translateY(0); }
.app-dp-leave      { transition: opacity 0.1s ease, transform 0.1s ease; }
.app-dp-leave-start { opacity: 1; transform: translateY(0); }
.app-dp-leave-end   { opacity: 0; transform: translateY(-4px); }

[x-cloak] { display: none !important; }

.app-dp-panes {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

/* ----------------------------------------
   CALENDAR (left pane)
   ---------------------------------------- */

.app-dp-cal {
    flex: 1;
    padding: 0.72rem 0.72rem 0.6rem;
    border-right: 1px solid #f3f4f6;
    min-width: 220px;
}

.dark .app-dp-cal { border-right-color: #1e293b; }

.app-dp-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.app-dp-cal-title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex: 1;
}

.app-dp-nav-select {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 0.88rem;
    font-weight: 800;
    color: #111827;
    cursor: pointer;
    border-radius: 0.4rem;
    transition: background 0.15s;
    text-align: center;
}

.app-dp-nav-select:hover {
    background: #f3f4f6;
}

.app-dp-nav-select:focus {
    outline: 2px solid #2563eb;
    background: #ffffff;
}

.dark .app-dp-nav-select {
    color: #f1f5f9;
}

.dark .app-dp-nav-select:hover {
    background: #1e293b;
}

.dark .app-dp-nav-select:focus {
    background: #0f172a;
}

.app-dp-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.app-dp-nav-btn:hover { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.dark .app-dp-nav-btn { border-color: #334155; color: #94a3b8; }
.dark .app-dp-nav-btn:hover { background: rgba(37,99,235,0.12); color: #60a5fa; border-color: #3b82f6; }
.app-dp-nav-btn svg { width: 0.85rem; height: 0.85rem; }

.app-dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.35rem;
}

.app-dp-weekdays span {
    text-align: center;
    font-size: 0.67rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0;
}

.dark .app-dp-weekdays span { color: #4b5563; }

.app-dp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    margin-bottom: 0.25rem;
}

.app-dp-day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    font-size: 0.8rem;
    font-weight: 600;
    color: #111827;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
    outline: none;
    width: 1.9rem;
    height: 1.9rem;
    margin: 0 auto;
}

.app-dp-day:hover:not(.app-dp-day--other) { background: #eff6ff; color: #2563eb; }
.app-dp-day--other { color: #d1d5db; cursor: default; pointer-events: none; }
.app-dp-day--today { color: #2563eb; font-weight: 800; }
.app-dp-day--selected {
    background: #2563eb !important;
    color: #ffffff !important;
    border-radius: 0.5rem;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.32);
}
.app-dp-day--selected:hover { background: #1d4ed8 !important; }

.dark .app-dp-day { color: #cbd5e1; }
.dark .app-dp-day:hover:not(.app-dp-day--other) { background: rgba(37,99,235,0.15); color: #60a5fa; }
.dark .app-dp-day--other { color: #1e293b; }
.dark .app-dp-day--today { color: #3b82f6; }

.app-dp-today-dot {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #2563eb;
}

.dark .app-dp-today-dot { background: #3b82f6; }

/* ----------------------------------------
   TIME PICKER (right pane) - Digital Style
   ---------------------------------------- */

.app-dp-time {
    width: 200px;
    flex-shrink: 0;
    padding: 1.25rem 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%);
    border-left: 1px solid #e2e8f0;
}

.dark .app-dp-time {
    background: linear-gradient(180deg, #0b1222 0%, #0f172a 100%);
    border-left-color: #1e293b;
}

.app-dp-time-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.app-dp-time-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-dp-time-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.app-dp-time-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e40af;
    line-height: 1;
    width: 2.8rem;
    text-align: center;
    padding: 0.3rem 0.25rem;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 0.6rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}

.app-dp-time-value:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.14);
}

.dark .app-dp-time-value {
    background: #1e293b;
    border-color: #334155;
    color: #93c5fd;
}

.dark .app-dp-time-value:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}

.app-dp-spin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 1.6rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.45rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
    flex-shrink: 0;
}

.app-dp-spin-btn svg {
    width: 0.8rem;
    height: 0.8rem;
    pointer-events: none;
}

.app-dp-spin-btn:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.dark .app-dp-spin-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.dark .app-dp-spin-btn:hover {
    background: rgba(37,99,235,0.15);
    color: #60a5fa;
    border-color: #3b82f6;
}

.app-dp-time-sub {
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-dp-time-sep {
    font-size: 1.5rem;
    font-weight: 800;
    color: #cbd5e1;
    padding-bottom: 1.2rem;
}

.app-dp-ampm-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 0.5rem;
    gap: 0.2rem;
}

.dark .app-dp-ampm-toggle {
    background: #1e293b;
}

.app-dp-ampm-btn {
    padding: 0.35rem 1rem;
    font-size: 0.72rem;
    font-weight: 800;
    border: none;
    background: transparent;
    border-radius: 0.4rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.app-dp-ampm-btn--active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.dark .app-dp-ampm-btn--active {
    background: #3b82f6;
    color: #ffffff;
}

.app-dp-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.65rem 0.72rem 0.72rem;
    border-top: 1px solid #e2e8f0;
}

.dark .app-dp-action-row {
    border-top-color: #1e293b;
}

.app-dp-action-btn {
    min-height: 2rem;
    padding: 0.32rem 0.9rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.14s ease;
}

.app-dp-action-cancel {
    background: #e2e8f0;
    color: #334155;
}

.app-dp-action-cancel:hover {
    background: #cbd5e1;
}

.dark .app-dp-action-cancel {
    background: #334155;
    color: #cbd5e1;
}

.dark .app-dp-action-cancel:hover {
    background: #475569;
}

.app-dp-action-apply {
    background: #2563eb;
    color: #ffffff;
}

.app-dp-action-apply:hover {
    background: #1d4ed8;
}

@media (max-width: 768px) {
    .app-dp-wrap {
        width: 100%;
    }

    .app-dp-input {
        width: 100%;
        min-width: 0;
    }

    .app-dp-dialog {
        width: min(100vw - 1rem, 24.5rem);
        max-height: min(92vh, 680px);
    }

    .app-dp-panes {
        flex-direction: column;
    }

    .app-dp-cal {
        border-right: none;
        border-bottom: 1px solid #f3f4f6;
        min-width: 0;
    }

    .dark .app-dp-cal {
        border-bottom-color: #1e293b;
    }

    .app-dp-time {
        width: 100%;
        border-left: none;
        padding: 0.62rem;
    }

    .app-dp-day {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.74rem;
    }

    .app-dp-time-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 0.45rem 0.35rem;
        align-items: start;
    }

    .app-dp-time-body > .app-dp-time-col:first-of-type {
        grid-column: 1;
        grid-row: 1;
    }

    .app-dp-time-body > .app-dp-time-sep {
        grid-column: 2;
        grid-row: 1;
        padding-top: 1.2rem;
    }

    .app-dp-time-body > .app-dp-time-col:last-of-type {
        grid-column: 3;
        grid-row: 1;
    }

    .app-dp-ampm {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-direction: row;
        justify-content: center;
        padding-top: 0.1rem;
        gap: 0.5rem;
    }

    .app-dp-ampm-btn {
        min-width: 4.2rem;
        min-height: 1.85rem;
    }

    .app-dp-time-scroll {
        max-height: 122px;
    }
}
