/* School Insight ERP — Custom 3D Calendar (no Flatpickr dependency) */

.si-date-field {
    position: relative;
    display: block;
    width: 100%;
}

.si-date-field .si-date-native {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.si-date-field .si-date-display {
    width: 100%;
    padding-right: 2.9rem !important;
    cursor: pointer;
    background: linear-gradient(160deg, #FFFFFF 0%, #F4F8FF 100%);
    border: 1px solid rgba(79, 142, 247, 0.2);
    border-radius: 12px;
    box-shadow:
        0 2px 4px rgba(23, 43, 77, 0.04),
        0 8px 18px rgba(79, 142, 247, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.si-date-field .si-date-display:hover {
    border-color: rgba(79, 142, 247, 0.4);
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px rgba(79, 142, 247, 0.16),
        0 2px 6px rgba(23, 43, 77, 0.05);
}

.si-date-field .si-date-display:focus,
.si-date-field .si-date-display.active {
    border-color: rgba(79, 142, 247, 0.55);
    box-shadow:
        0 0 0 0.22rem rgba(79, 142, 247, 0.16),
        0 12px 28px rgba(79, 142, 247, 0.18);
    outline: 0;
}

.si-date-field .si-date-display.is-invalid {
    border-color: #DC2626;
}

.si-date-trigger {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.15rem;
    height: 2.15rem;
    border: 0;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #7CC6FE, #4F8EF7 55%, #3A7AE8);
    box-shadow:
        0 8px 16px rgba(79, 142, 247, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.85rem;
    z-index: 2;
}

.si-date-trigger:hover {
    filter: brightness(1.05);
}

/* --------------------------------------------------------------------------
   Calendar popup
   -------------------------------------------------------------------------- */
.si-calendar {
    position: absolute;
    z-index: 100000;
    width: 320px;
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.si-calendar.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.si-cal-card {
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(165deg, #FFFFFF 0%, #F7FAFF 55%, #EEF5FF 100%);
    border: 1px solid rgba(79, 142, 247, 0.18);
    box-shadow:
        0 2px 4px rgba(23, 43, 77, 0.05),
        0 18px 40px rgba(79, 142, 247, 0.22),
        0 40px 70px rgba(23, 43, 77, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    font-family: 'Inter', system-ui, sans-serif;
}

.si-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.85rem 0.75rem;
    background: linear-gradient(135deg, #4F8EF7 0%, #3A7AE8 48%, #7CC6FE 100%);
    box-shadow:
        0 10px 24px rgba(79, 142, 247, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.si-cal-nav {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.si-cal-nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.si-cal-title {
    display: flex;
    gap: 0.35rem;
    flex: 1;
    justify-content: center;
}

.si-cal-month,
.si-cal-year {
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.35rem 0.45rem;
    cursor: pointer;
    outline: 0;
}

.si-cal-month option,
.si-cal-year option {
    color: #172B4D;
}

.si-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.15rem;
    padding: 0.55rem 0.65rem 0.2rem;
    background: rgba(79, 142, 247, 0.06);
}

.si-cal-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #4F8EF7;
}

.si-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.2rem;
    padding: 0.45rem 0.65rem 0.55rem;
}

.si-cal-day {
    height: 38px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #172B4D;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.si-cal-day:hover:not(:disabled):not(.is-selected) {
    background: linear-gradient(160deg, #FFFFFF, #EAF3FF);
    border-color: rgba(79, 142, 247, 0.22);
    transform: translateY(-2px);
    box-shadow:
        0 8px 16px rgba(79, 142, 247, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.si-cal-day.is-outside {
    color: #94A3B8;
}

.si-cal-day.is-today {
    border-color: rgba(79, 142, 247, 0.5);
    background: rgba(79, 142, 247, 0.1);
    color: #3A7AE8;
    font-weight: 800;
}

.si-cal-day.is-selected,
.si-cal-day.is-selected:hover {
    background: linear-gradient(145deg, #7CC6FE, #4F8EF7 55%, #3A7AE8) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow:
        0 10px 20px rgba(79, 142, 247, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform: translateY(-2px) scale(1.04);
}

.si-cal-day.is-disabled,
.si-cal-day:disabled {
    color: #CBD5E1 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: not-allowed;
}

.si-cal-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem 0.8rem;
    border-top: 1px solid rgba(79, 142, 247, 0.1);
}

.si-cal-today,
.si-cal-clear {
    border: 0;
    border-radius: 9px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.si-cal-today {
    color: #fff;
    background: linear-gradient(145deg, #7CC6FE, #4F8EF7);
    box-shadow: 0 6px 14px rgba(79, 142, 247, 0.28);
}

.si-cal-clear {
    color: #667085;
    background: rgba(79, 142, 247, 0.08);
}

.si-cal-today:hover,
.si-cal-clear:hover {
    filter: brightness(1.05);
}

@media (max-width: 420px) {
    .si-calendar {
        width: min(300px, calc(100vw - 20px));
    }

    .si-cal-day {
        height: 34px;
        font-size: 0.82rem;
    }
}
