/* =========================================================
   THEME BACKGROUNDS & BORDERLESS DESIGN
   ========================================================= */
/* Sleek light mode gradient - Darkened for contrast against white cards/sidebar */
body[data-bs-theme="light"] {
    background: #e9ecef !important;
}
/* Premium dark blue gradient */
body[data-bs-theme="dark"] {
    background: #0f172a !important;
}

/* Strip all borders and shadows */
.modern-card, .btn-group, .input-group-text, .form-control, .card-footer {
    box-shadow: none !important;
    border: none !important;
    background-color: var(--bs-body-bg) !important;
}
.modern-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important; /* Extremely subtle lift */
}

/* =========================================================
   GEMINI-STYLE SIDEBAR LOGIC & ALIGNMENT
   ========================================================= */
#sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--bs-body-bg) !important;
    border: none !important;
    box-shadow: 2px 0 12px rgba(0,0,0,0.03); /* Soft edge instead of hard border */
}

.sidebar-collapsed { width: 76px !important; }
.sidebar-collapsed .nav-text,
.sidebar-collapsed .brand-text { display: none !important; }

/* Dynamic Logo Display */
.sidebar-expanded #logoCollapsed { display: none !important; }
.sidebar-collapsed #logoExpanded { display: none !important; }

/* Perfect Alignment wrapper */
.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 16px;
    border-radius: 8px;
    margin: 0 8px 4px 8px; /* Creates a floating pill effect */
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    color: var(--bs-body-color);
}

.sidebar-item:hover { background-color: var(--bs-tertiary-bg); }
.sidebar-item.active {
    background-color: #e0f2fe; /* Light blue tint */
    color: #0284c7;
    font-weight: 600;
}

[data-bs-theme="dark"] .sidebar-item.active {
    background-color: #0369a1; color: #f0f9ff;
}

/* Strict Icon Container guarantees text aligns perfectly */
.icon-wrapper {
    width: 24px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    margin-right: 16px; /* Strict whitespace */
}

/* Perfect centering when collapsed */
.sidebar-collapsed .sidebar-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.sidebar-collapsed .icon-wrapper {
    margin-right: 0 !important;
}

/* =========================================================
   HEADER & TOGGLE
   ========================================================= */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 16px;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

/* Hide toggle icon when collapsed (optional, if logo acts as toggle) */
.sidebar-collapsed #sidebarToggle { display: none; }

/* =========================================================
   DASHBOARD CANVAS & COMPONENTS
   ========================================================= */
#canvasWrapper { position: relative; width: 100%; height: 400px; }
canvas { width: 100%; height: 100%; border-radius: 8px; border: none; background: #fafafa; }
[data-bs-theme="dark"] canvas { background: #1a2235; }
.axis-label-container { position: absolute; left: -75px; top: 0; height: 100%; display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; text-align: right; width: 65px; pointer-events: none; font-weight: bold; }
.scada-ruler { position: absolute; top:0; width: 1px; height: 100%; pointer-events: none; display: none; }
#ruler1 { background-color: var(--bs-body-color); opacity: 0.5; }
#ruler2 { border-left: 2px dashed #0ea5e9; }
#rulerTimeAxisBox { position: absolute; bottom: 0px; transform: translateX(-50%); background: var(--bs-body-color); color: var(--bs-body-bg); padding: 4px 8px; font-size: 11px; font-family: monospace; border-radius: 4px; display: none; pointer-events: none; white-space: nowrap; z-index: 20; }
.trend-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; display: none; border: 1.5px solid var(--bs-body-bg); z-index: 10; }
.trend-dot-label { position: absolute; left: 12px; top: -8px; font-size: 11px; font-family: monospace; font-weight: bold; pointer-events: none; white-space: nowrap; text-shadow: -1px -1px 0 var(--bs-body-bg), 1px -1px 0 var(--bs-body-bg), -1px 1px 0 var(--bs-body-bg), 1px 1px 0 var(--bs-body-bg); }


/* =========================================================
   GLOBAL TYPOGRAPHY & UTILITIES
   ========================================================= */
.text-micro { font-size: 11px; letter-spacing: 0.5px; }
.text-small { font-size: 12px; letter-spacing: 0.5px; }
.text-base { font-size: 13px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }

/* =========================================================
   AUTH & LOGIN
   ========================================================= */
.auth-wrapper {
    width: 100%;
    max-width: 400px;
}

/* =========================================================
   UPLOADS COMPONENT
   ========================================================= */
.upload-drop-zone {
    border-style: dashed !important;
    min-height: 280px;
    background-color: var(--bs-tertiary-bg);
}

.period-selector {
    width: 150px;
}

/* =========================================================
   STANDARD FORMS & UPLOADS OVERRIDES
   ========================================================= */
/* Restores borders and background contrast for inputs outside the Trends canvas */
.form-control.border-secondary {
    border: 1px solid var(--bs-border-color) !important;
    background-color: var(--bs-tertiary-bg) !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03) !important;
}

/* Ensure focus states still look premium */
.form-control.border-secondary:focus {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 0 0.25rem rgba(14, 165, 233, 0.25) !important;
}