/* --- SCROLLBARS --- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Day Cell Scrolling */
.day-cell .job-list-container {
    overflow-y: hidden;
    padding-right: 2px;
    transition: all 0.2s ease;
}
.day-cell:hover .job-list-container {
    overflow-y: auto;
}
.day-cell .job-list-container::-webkit-scrollbar { width: 3px; }
.day-cell .job-list-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }
.dark .day-cell .job-list-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* --- ICONS & TRANSITIONS --- */
.icon { width: 20px; height: 20px; stroke-width: 1.8; }
#main-layout-grid { transition: grid-template-columns 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }

/* SIDEBAR TRANSITIONS */
#sidebar-container { 
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); 
    overflow: visible; 
    position: relative;
    z-index: 50;
}

/* MINI SIDEBAR MODE (90px width) */
body.sidebar-mini #sidebar-container { width: 90px !important; }
body.sidebar-mini .sidebar-text { opacity: 0; pointer-events: none; display: none; }

/* SIDEBAR HEADER & LOGO ANIMATION */
.sidebar-header {
    transition: padding 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), gap 0.4s ease;
    gap: 16px; 
    padding-left: 24px;
    padding-right: 24px;
    display: flex;
    align-items: center;
}

/* Mini Mode: Center the logo, remove gap */
body.sidebar-mini .sidebar-header { 
    padding-left: 0; 
    padding-right: 0; 
    gap: 0;
    justify-content: center; 
}

/* TEXT ANIMATIONS (Business Name & Weather) */
.sidebar-logo-text { 
    overflow: hidden; 
    white-space: nowrap;
    transition: opacity 0.2s ease, max-width 0.4s ease;
}

/* Default State (Open) */
.sidebar-logo-text h1 { 
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease; 
    transition-delay: 0.1s; 
    transform: translateY(0); 
    opacity: 1;
}
.sidebar-logo-text #weather-display { 
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease; 
    transition-delay: 0.15s; 
    transform: translateY(0); 
    opacity: 1;
}

/* Mini State (Hidden) */
body.sidebar-mini .sidebar-logo-text {
    pointer-events: none;
    max-width: 0;
    opacity: 0;
    margin: 0;
}

body.sidebar-mini .sidebar-logo-text h1 { 
    opacity: 0; 
    transform: translateY(-15px); 
    transition: transform 0.3s ease, opacity 0.2s ease; 
    transition-delay: 0s; 
}

body.sidebar-mini .sidebar-logo-text #weather-display { 
    opacity: 0; 
    transform: translateY(15px); 
    transition: transform 0.3s ease, opacity 0.2s ease; 
    transition-delay: 0s; 
}

/* Hides details in mini mode */
body.sidebar-mini .sidebar-user-details { display: none; }
body.sidebar-mini #sidebar-menu a { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-mini .sidebar-footer { flex-direction: column; gap: 12px; align-items: center; padding: 12px 0; }

/* Mini Mode: Theme Toggles become Side-by-Side Icons */
body.sidebar-mini #theme-buttons-container { flex-direction: row; gap: 4px; width: 100%; align-items: center; justify-content: center; padding: 0 8px; }

/* UPDATED: Theme Buttons in Mini Mode (SVG Handling) */
body.sidebar-mini #theme-dark, body.sidebar-mini #theme-light { 
    padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; 
}
body.sidebar-mini #theme-dark span, body.sidebar-mini #theme-light span { display: none; }
body.sidebar-mini #theme-dark svg, body.sidebar-mini #theme-light svg { display: block !important; width: 16px; height: 16px; }

/* Mini Mode Active States */
body.sidebar-mini #theme-dark.active-theme { background-color: transparent !important; color: #3b82f6 !important; border: 1px solid #3b82f6 !important; }
body.sidebar-mini #theme-light.active-theme { background-color: transparent !important; color: #10b981 !important; border: 1px solid #10b981 !important; }

/* Mini Mode Inactive States */
body.sidebar-mini #theme-dark:not(.active-theme), body.sidebar-mini #theme-light:not(.active-theme) { background-color: transparent; color: #94a3b8; border: 1px solid #e2e8f0; }
.dark body.sidebar-mini #theme-dark:not(.active-theme), .dark body.sidebar-mini #theme-light:not(.active-theme) { color: #64748b; border-color: rgba(255,255,255,0.1); }

/* UPDATED: OPEN SIDEBAR THEME BUTTONS (Highlights match Menu) */
/* Light Mode Active (Green) */
body:not(.sidebar-mini) #theme-light.active-theme {
    background-color: rgba(59, 128, 48, 0.1); /* bg-brand-green/10 */
    color: #3b8030; /* text-brand-green */
    border-color: transparent;
    font-weight: 600;
}
/* Dark Mode Active (Blue) */
body:not(.sidebar-mini) #theme-dark.active-theme {
    background-color: rgba(59, 130, 246, 0.15); /* dark:bg-blue-500/15 */
    color: #3b82f6; /* dark:text-blue-400 (approx) */
    border-color: transparent;
    font-weight: 600;
}
.dark body:not(.sidebar-mini) #theme-dark.active-theme { color: #60a5fa; } 

/* Mini Mode: User Profile Stacked & Slick */
body.sidebar-mini #user-profile-box { background: transparent; border: none; padding: 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
body.sidebar-mini #user-avatar { margin: 0; width: 40px; height: 40px; font-size: 14px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* Logout button spacing and size */
body.sidebar-mini #logout-btn { display: flex !important; margin-top: 6px; margin-bottom: 12px; width: 28px; height: 28px; background: white; border: 1px solid #e2e8f0; color: #64748b; z-index: 10; transition: all 0.2s; transform: none; }
body.sidebar-mini #logout-btn:hover { background-color: #ef4444 !important; color: white !important; border-color: #ef4444 !important; }
body.sidebar-mini #logout-btn svg { width: 12px; height: 12px; }
.dark body.sidebar-mini #logout-btn { background: #1a1d21; border-color: rgba(255,255,255,0.2); }

/* SIDEBAR TOGGLE BUTTON */
.sidebar-toggle-edge {
    position: absolute;
    top: 68px; 
    right: -12px;
    width: 24px;
    height: 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 60;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.2s;
}
.sidebar-toggle-edge:hover { color: #0f172a; background: #f8fafc; }
.dark .sidebar-toggle-edge { background: #1a1d21; border-color: rgba(255,255,255,0.1); color: #94a3b8; }
.dark .sidebar-toggle-edge:hover { color: white; background: #272a30; }

body.sidebar-mini .sidebar-toggle-edge svg { transform: rotate(180deg); }

/* --- DRAG & DROP VISUALS --- */
.calendar-drag-mode .valid-drop { background: rgba(59, 128, 48, 0.1) !important; border: 2px dashed #3b8030 !important; }
.dark .calendar-drag-mode .valid-drop { background: rgba(16, 185, 129, 0.1) !important; border: 2px dashed #10b981 !important; }
.invalid-drop { background: rgba(220, 38, 38, 0.1) !important; border: 2px dashed #dc2626 !important; cursor: no-drop !important; }

/* Ghost Card Styling */
.custom-drag-image { position: fixed; pointer-events: none; z-index: 999999; margin: 0; }
.ghost-card-style { opacity: 1 !important; box-shadow: 0 10px 25px rgba(0,0,0,0.3); transform: scale(1.02); }

/* --- PATTERNS --- */
.bg-pattern-nowork { background-color: rgba(120, 113, 108, 0.15); } 
.dark .bg-pattern-nowork { background-color: rgba(255, 255, 255, 0.03); }
.bg-pattern-rain { background-color: rgba(254, 226, 226, 0.6); }
.dark .bg-pattern-rain { background-color: rgba(127, 29, 29, 0.3); }

.crossed-out { background-image: linear-gradient(to top right, transparent calc(50% - 1px), rgba(120, 113, 108, 0.3) 50%, transparent calc(50% + 1px)), linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(120, 113, 108, 0.3) 50%, transparent calc(50% + 1px)), linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(120, 113, 108, 0.3) 50%, transparent calc(50% + 1px)); }
.dark .crossed-out { background-image: linear-gradient(to top right, transparent calc(50% - 1px), rgba(255, 255, 255, 0.1) 50%, transparent calc(50% + 1px)), linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(255, 255, 255, 0.1) 50%, transparent calc(50% + 1px)); }

/* --- JOB CARDS --- */
.job-chip { height: 26px; display: flex; align-items: center; padding: 0 8px; font-size: 11px; font-weight: 700; border-radius: 5px; margin-bottom: 4px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,0.15); transition: transform 0.1s, box-shadow 0.1s; border: 1px solid rgba(255,255,255,0.1); color: white; }
.job-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 6px rgba(0,0,0,0.2); z-index: 10; }
.job-chip:active { cursor: grabbing; }

.chip-green { background: linear-gradient(135deg, #10b981, #059669); border-color: #34d399; text-shadow: 0 1px 1px rgba(0,0,0,0.1); }
.chip-red { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: #f87171; text-shadow: 0 1px 1px rgba(0,0,0,0.1); }
.chip-stone { background: linear-gradient(135deg, #57534e, #44403c); border-color: #78716c; text-shadow: 0 1px 1px rgba(0,0,0,0.1); }
.chip-yellow { background: linear-gradient(135deg, #facc15, #eab308); color: #0f172a !important; border-color: #fde047; text-shadow: none; }

.dark .chip-green { background: linear-gradient(135deg, #059669, #047857); border-color: #065f46; }
.dark .chip-red { background: linear-gradient(135deg, #b91c1c, #991b1b); border-color: #7f1d1d; }
.dark .chip-stone { background: linear-gradient(135deg, #44403c, #292524); border-color: #57534e; }
.dark .chip-yellow { background: linear-gradient(135deg, #ca8a04, #a16207); color: white !important; border-color: #854d0e; }

/* --- HELP SYSTEM (SUBTLE) --- */
body.help-mode [data-help]:hover { outline: 1px dashed rgba(255, 255, 255, 0.4); outline-offset: 2px; }
.help-tooltip { position: fixed; background: rgba(15, 23, 42, 0.95); color: #cbd5e1; padding: 8px 12px; border-radius: 6px; font-size: 12px; max-width: 240px; z-index: 999999; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity 0.15s ease, transform 0.15s ease; line-height: 1.4; border: 1px solid rgba(255,255,255,0.05); font-family: 'Inter', sans-serif; font-weight: 400; }
.dark .help-tooltip { background: rgba(255, 255, 255, 0.95); color: #334155; border: 1px solid rgba(0,0,0,0.05); }
.help-tooltip.visible { opacity: 1; transform: translateY(0); }
.help-tooltip strong { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: #fff; }
.dark .help-tooltip strong { color: #0f172a; }
.help-tooltip em { font-style: normal; opacity: 0.7; font-size: 11px; display: block; margin-bottom: 4px; }
.help-tooltip ul { margin: 4px 0 0 0; padding-left: 10px; list-style: disc; }
.help-tooltip li { margin-bottom: 2px; }

/* --- MODALS & MAP --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 200; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.leaflet-container { background: #f0f0f0; font-family: 'Inter', sans-serif; height: 100%; width: 100%; z-index: 1; }
.dark .leaflet-container { background: #1a1d21; }
.dark .leaflet-tile { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }

/* --- PEEK WINDOW --- */
#day-peek-window { position: fixed; z-index: 100; pointer-events: none; opacity: 0; transform: scale(0.95) translateY(10px); transition: opacity 0.15s ease-out, transform 0.15s ease-out; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3); }
#day-peek-window.active { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }

/* --- UTILS --- */
.search-blink { border: 2px solid #facc15 !important; animation: pulse-border 1.5s infinite; }
@keyframes pulse-border { 0% { border-color: #facc15; } 50% { border-color: transparent; } 100% { border-color: #facc15; } }
.search-hidden { display: none !important; }
.drag-collapsed { opacity: 0.6 !important; transform: scale(0.95); filter: grayscale(100%); }
.drop-indicator { height: 0; transition: height 0.2s ease; overflow: hidden; }
.drop-indicator.active { height: 60px; background: rgba(59, 128, 48, 0.1); border: 2px dashed #3b8030; margin: 8px 0; border-radius: 8px; }
.flash-success { animation: flash-green 2s ease-out; }
@keyframes flash-green { 0% { box-shadow: 0 0 0 2px #10b981; }100% { box-shadow: 0 0 0 0 transparent; } }

/* --- PHYSICS & DRAG --- */
:root { --anim-speed: 0.5s; --anim-curve: cubic-bezier(0.32, 0.72, 0, 1); }
.job-card-transition { transition: margin-top var(--anim-speed) var(--anim-curve), transform var(--anim-speed) var(--anim-curve), opacity 0.3s ease; will-change: margin, transform; transform: translateZ(0); }

/* --- TRUCK UI --- */
.truck-badge:hover { filter: brightness(1.1); transform: scale(1.05); cursor: pointer; }
.truck-badge:active { transform: scale(0.95); }

/* --- PHONE POPOVER (Updated Colors) --- */
.phone-popover {
    position: absolute; background: white; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); z-index: 50; overflow: hidden; animation: popIn 0.15s ease-out; display: flex; padding: 4px; gap: 4px;
}
.dark .phone-popover { background: #1e293b; border-color: rgba(255,255,255,0.1); }
.phone-popover button {
    padding: 6px 12px; font-size: 12px; font-weight: 600; border-radius: 4px; transition: all 0.1s; display: flex; align-items: center; gap: 6px;
}
/* Light Mode Popover Buttons */
.phone-popover button.call-btn { color: #047857; background: #d1fae5; border: 1px solid #a7f3d0; }
.phone-popover button.call-btn:hover { background: #10b981; color: white; border-color: #10b981; }

.phone-popover button.text-btn { color: #44403c; background: #f5f5f4; border: 1px solid #e7e5e4; }
.phone-popover button.text-btn:hover { background: #78716c; color: white; border-color: #78716c; }

/* Dark Mode Overrides */
.dark .phone-popover button.call-btn { color: #10b981; background: rgba(16, 185, 129, 0.1); border-color: transparent; }
.dark .phone-popover button.call-btn:hover { background: rgba(16, 185, 129, 0.2); }
.dark .phone-popover button.text-btn { color: #3b82f6; background: rgba(59, 130, 246, 0.1); border-color: transparent; }
.dark .phone-popover button.text-btn:hover { background: rgba(59, 130, 246, 0.2); }

/* --- LOCK BUTTON --- */
#lock-route-btn.locked { background-color: #ef4444; color: white; border-color: #ef4444; }
#lock-route-btn.locked:hover { background-color: #dc2626; }

/* --- REORDER WARNING --- */
.reorder-warning {
    background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #d97706;
    font-size: 11px; font-weight: 600; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.dark .reorder-warning { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border-color: rgba(245, 158, 11, 0.2); }

/* --- ANIMATIONS --- */

/* 1. Pop-In for Menus */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 2. Slide In Right for New Jobs */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); max-width: 0; margin-right: 0; padding: 0; border: 0; }
    to { opacity: 1; transform: translateX(0); max-width: 200px; margin-right: 0.5rem; padding: 0.375rem 0.75rem; border: 1px solid; }
}

.new-job-enter {
    animation: slideInRight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    overflow: hidden;
    white-space: nowrap;
}

/* --- CUSTOM ALERT MODAL --- */
#custom-alert-content.scale-100 { transform: scale(1); opacity: 1; }

/* UPDATED: Day Cell Hover & Selection (Green in Light Mode) */
.day-cell { transition: border-color 0.2s; }
.day-cell:hover { border-color: #3b8030 !important; } /* Brand Green */
.dark .day-cell:hover { border-color: #3b82f6 !important; } /* Blue */