/* ==========================================================
   SIDEBAR COMPONENT — Tick Control, LLC
   Standalone reusable sidebar styles.
   Works on desktop and iPad (PWA standalone).
   ========================================================== */

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

/* --- ICONS --- */
.icon { width: 20px; height: 20px; stroke-width: 1.8; }

/* --- GRID TRANSITION (host page needs #main-layout-grid) --- */
#main-layout-grid { transition: grid-template-columns 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }

/* ==========================================================
   SIDEBAR CONTAINER
   ========================================================== */
#sidebar-container {
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: visible;
    position: relative;
    z-index: 50;
    padding-top: env(safe-area-inset-top, 0px);
}

/* ==========================================================
   MINI SIDEBAR MODE (90px collapsed)
   ========================================================== */
body.sidebar-mini #sidebar-container { width: 90px !important; }
body.sidebar-mini #main-layout-grid { grid-template-columns: 90px 1fr !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;
}

/* ==========================================================
   MINI MODE — USER DETAILS & MENU
   ========================================================== */
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; }

/* 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); }

/* ==========================================================
   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);
    color: #3b8030;
    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);
    color: #3b82f6;
    border-color: transparent;
    font-weight: 600;
}
.dark body:not(.sidebar-mini) #theme-dark.active-theme { color: #60a5fa; }

/* ==========================================================
   MINI MODE — USER PROFILE
   ========================================================== */
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 (edge circle)
   ========================================================== */
.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); }

/* ==========================================================
   iPAD-SPECIFIC OVERRIDES
   ========================================================== */
body.is-ipad .sidebar-toggle-edge {
    top: calc(env(safe-area-inset-top, 0px) + 68px) !important;
}
