/* Modal Overlay - Smooth Fade */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    /* slate-900 with opacity */
    backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Modal Content - Scale & Fade */
.modal-content {
    background-color: #1e293b;
    /* slate-800 */
    border: 1px solid rgba(71, 85, 105, 0.5);
    /* slate-600 */
    border-radius: 0.75rem;
    /* rounded-xl */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(10px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.open .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Settings Drawer - Slide In */
.settings-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    /* or max-w-xl */
    max-width: 90vw;
    height: 100vh;
    background-color: #0f172a;
    /* slate-900 */
    border-left: 1px solid rgba(51, 65, 85, 0.5);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 70;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.settings-drawer.open {
    transform: translateX(0);
}

/* Backdrop for Drawer */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Utility: Hide Scrollbar but allow scrolling */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Drag and Drop Styles */
.dashboard-widget {
    cursor: grab;
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s;
    touch-action: none;
    z-index: 20;
    transform: translateZ(0); /* Hardware isolation */
    will-change: transform;
}

.dashboard-widget:active {
    cursor: grabbing;
}

.dashboard-widget.dragging {
    opacity: 0.5;
    background-color: rgba(30, 41, 59, 0.9);
    /* visual feedback */
    border: 2px dashed #6366f1 !important;
    cursor: grabbing;
    z-index: 30;
    /* Bring to front */
}

/* Ensure Drop Target */
#dashboardGrid {
    min-height: 300px;
    height: 100%;
    position: relative;
    /* Ensure it receives events */
    pointer-events: auto;
    z-index: 10;
}

.dragging {
    /* Fallback generic class */
    opacity: 0.5;
}

.dashboard-widget.drag-over {
    border-top: 4px solid #6366f1 !important;
}

/* Mobile Dashboard Layout */
@media (max-width: 1219px) {
    #dashboardGrid {
        display: flex;
        flex-direction: column;
    }

    #dashboardGrid::after {
        content: '';
        display: block;
        height: 96px;
        /* Explicit bottom spacing */
        flex: none;
    }

    #dashboardGrid>div {
        flex: none;
        height: 350px;
        min-height: 350px;
    }

    /* Note widgets can be a bit shorter */
    #dashboardGrid>div[id^="widget-"] {
        height: 250px;
        min-height: 250px;
    }

    .dashboard-widget {
        touch-action: pan-y;
    }
}

/* Custom Date Picker Styles */
.calendar-day {
    position: relative;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    padding: 0.125rem 0; /* Shrink vertical space instead of a forced aspect ratio */
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day:hover {
    background-color: rgba(51, 65, 85, 0.5);
    /* hover:bg-slate-700/50 */
}

.calendar-date-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem; /* Reduced from 1.75rem */
    height: 1.5rem; /* Reduced from 1.75rem */
    border-radius: 9999px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.calendar-day-scheduled .calendar-date-number {
    border-color: rgba(249, 115, 22, 0.6);
    /* subtle orange ring */
}

.calendar-day-recorded .calendar-date-number {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgb(16, 185, 129) !important;
    color: rgb(52, 211, 153) !important;
}

.calendar-day-absent .calendar-date-number {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: rgb(239, 68, 68) !important;
    color: rgb(248, 113, 113) !important;
}

.calendar-day-selected .calendar-date-number {
    background-color: rgba(59, 130, 246, 0.4) !important;
    border-color: rgb(59, 130, 246) !important;
    color: white !important;
}

/* Ensure native date picker calendar icons are visible on dark backgrounds and larger */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    /* Invert black to white, slightly dim by default */
    filter: invert(1) brightness(0.8);
    /* Make the clickable icon larger */
    transform: scale(1.4);
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.5);
}

/* Custom Inline Audio Player Spacing */
.custom-audio-player {
    gap: 0.75rem !important; /* 12px padding between play button, time marker, and scrubber */
}