/* ========================================
   BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Suppress sidebar transitions on initial page load */
.no-sidebar-transition .side-nav,
.no-sidebar-transition .side-nav *,
.no-sidebar-transition .container {
    transition: none !important;
}

.container {
    margin-left: 250px;
    /* Match sidebar width */
    padding: 10px 10px 10px 10px;
    width: calc(100vw - 250px);
    /* Utilize all remaining space */
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: margin-left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.container.expanded {
    margin-left: 72px;
    width: calc(100vw - 72px);
}

/* ========================================
   SIDE BAR STYLES
   ======================================== */
.side-nav {
    width: 250px;
    height: 100%;
    background: linear-gradient(180deg, #1a1c29 0%, #2d3748 50%, #1a202c 100%);
    position: fixed;
    top: 0;
    left: 0;
    padding: 25px 20px;
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: flex-direction 0.4s ease, gap 0.4s ease, padding 0.4s ease;
}

/* Collapse Button */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-top: auto;
    margin-bottom: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.sidebar-collapse-btn span {
    transition: opacity 0.3s ease,
        max-width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 100px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
}

.sidebar-collapse-btn i {
    font-size: 13px;
    transition: transform 0.3s ease;
}

.logo-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex: 1;
    min-width: 0;
}

.logo-nav:hover {
    transform: scale(1.02);
}

.logo-nav-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.1));
    transition: all 0.3s ease;
}

.logo-nav:hover .logo-nav-img {
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.2));
    transform: rotate(5deg);
}

.side-nav-links {
    list-style: none;
    position: relative;
    padding: 0;
    margin: 0;
}

.side-nav-links li {
    padding: 0;
    margin: 8px 0;
    position: relative;
}

.side-nav-links li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    padding: 16px 20px;
    align-items: center;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.side-nav-links li a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.side-nav-links li a:hover::before {
    opacity: 1;
}

.side-nav-links li a i {
    font-size: 18px;
    margin-right: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.side-nav-links li a p {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease,
        max-width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 150px;
    overflow: hidden;
    white-space: nowrap;
}



.side-nav-links li:hover a {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-left: 2px solid rgba(102, 126, 234, 0.6);
    transition: all 0.2s ease;
}

.side-nav-links li:hover a i {
    color: rgba(255, 255, 255, 0.9);
    transition: color 0.2s ease;
}

.side-nav-links li:hover a p {
    color: rgba(255, 255, 255, 0.95);
    transition: color 0.2s ease;
}

/* Active/Selected state */
.side-nav-links li.current a {
    color: #ffffff;
    background: rgba(102, 126, 234, 0.15);
    border-left: 3px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.side-nav-links li.current a i {
    color: #ffffff;
}

/* Remove complex hover effects for cleaner experience */

/* ========================================
   MODERN SIDEBAR ENHANCEMENTS
   ======================================== */

/* Modern tooltips for navigation items */
.side-nav-links li a[data-tooltip] {
    position: relative;
}

.side-nav-links li a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.side-nav-links li a[data-tooltip]::before {
    content: '';
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 7px 5px 0;
    border-color: transparent rgba(0, 0, 0, 0.9) transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.side-nav-links li:hover a[data-tooltip]::after,
.side-nav-links li:hover a[data-tooltip]::before {
    opacity: 1;
    visibility: visible;
}

/* Modern badge/notification support */
.nav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
    animation: pulse 2s infinite;
}

/* Modern focus states for accessibility */
.side-nav-links li a:focus {
    outline: 2px solid #67e8f9;
    outline-offset: 2px;
    border-radius: 12px;
}

.hamburger:focus {
    outline: 2px solid #67e8f9;
    outline-offset: 2px;
}

/* Add subtle animations for better UX */
.side-nav-links li {
    animation: slideInLeft 0.3s ease;
    animation-fill-mode: both;
}

.side-nav-links li:nth-child(1) {
    animation-delay: 0.1s;
}

.side-nav-links li:nth-child(2) {
    animation-delay: 0.2s;
}

.side-nav-links li:nth-child(3) {
    animation-delay: 0.3s;
}

.side-nav-links li:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* Icon smooth spin */
@keyframes spinSmooth {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* LOADING STATE */
.refresh-loading {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;

    transform: scale(1.03);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.6);
    animation: pulseGlow 1.2s infinite ease-in-out;
}

.refresh-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.refresh-inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.35s ease, opacity 0.25s ease;
}

/* FLIP OUT */
.refresh-flip-out .refresh-inner {
    transform: rotateX(90deg);
    opacity: 0;
}

/* FLIP IN */
.refresh-flip-in .refresh-inner {
    transform: rotateX(0deg);
    opacity: 1;
}

/* Glow pulse */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    }

    70% {
        box-shadow: 0 0 12px 4px rgba(34, 197, 94, 0.25);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* DONE STATE (VERY IMPORTANT) */
.refresh-done {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;

    transform: scale(1);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .side-nav-links li a,
    .active,
    .hamburger span {
        transition: none;
        animation: none;
    }
}

.logo-nav-icon {
    width: 45px;
    display: none;
}

/* Clean hamburger menu based on portfolio reference */
.hamburger {
    display: none;
    position: fixed;
    top: 20px;
}

.hamburger.is-active:hover,
.hamburger:hover {
    opacity: 0.7;
}

.hamburger.is-active .hamburger-inner,
.hamburger.is-active .hamburger-inner:after,
.hamburger.is-active .hamburger-inner:before {
    background-color: #fff;
}

/* Make card thumbnails show clickable cursor when hovered */
.card-thumb-wrap, .card-thumb-wrap .card-thumb {
    cursor: pointer;
}

/* Optional visual affordance: slight lift on hover */
.card-thumb-wrap:hover .card-thumb {
    transform: translateY(-3px);
    transition: transform 150ms ease;
}

/* Search input spinner */
.search-spinner {
    position: absolute;
    right: 18px;
    /* SAME as clear button */
    top: 50%;
    transform: translateY(-50%);

    width: 16px;
    height: 16px;

    border: 2px solid rgba(0, 0, 0, 0.12);
    border-top-color: #2b90ff;
    border-radius: 50%;

    animation: search-spin 0.9s linear infinite;

    display: none;
    pointer-events: none;
    /* don’t block input */
}

.search-spinner.visible {
    display: block;
}

@keyframes search-spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }

    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* LPR monitoring specific styles */
.lpr-controls {
    display: flex;
    align-items: center;
}

/* View mode (Grid/List) buttons */
.view-mode {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 2px solid #e2e8f0; /* match search input outline */
    padding: 6px 8px;
    border-radius: 8px;
    height: 40px;
}
.view-mode .view-btn { margin: 0 4px; }
.view-btn {
    background: transparent;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #1f2937; /* darker icon/text for visibility */
    font-size: 16px;
    align-items: center;
    justify-content: center;
}
.view-btn:hover { background: rgba(15,23,42,0.04); }
.view-btn i {
    font-size: 16px;
}
.view-btn.active {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 6px 14px rgba(2,6,23,0.18);
}
.view-btn:focus {
    outline: 2px solid rgba(99,102,241,0.18);
}

.lpr-controls .lpr-label {
    margin-right: 6px;
    font-weight: 600;
}

.lpr-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.lpr-search-icon {
    position: absolute;
    left: 20px;
    color: #a0aec0;
    font-size: 14px;
    pointer-events: none;
}

.lpr-search {
    padding: 10px 35px 10px 38px;
    margin: 10px;
    width: 280px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a202c;
    transition: all 0.3s ease;
}

.lpr-search-clear {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    display: none;
    line-height: 1;
}

.lpr-search-clear:hover {
    color: #c0392b;
}

.lpr-search:not(:placeholder-shown)+.lpr-search-clear {
    /* no-op: visibility now controlled by JS to keep clear-button placement flexible */
    display: none;
}

.lpr-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.lpr-table-info {
    margin-left: auto;
    margin-right: 10px;
    font-size: 0.85em;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    text-align: center;
}

.lpr-page-info {
    margin-left: auto;
    font-weight: 600;
}

.hamburger-box {
    position: relative;
    display: inline-block;
    width: 25px;
    height: 10px;
}

.hamburger-inner {
    top: 50%;
    display: block;
    margin-top: -15px;
}

.hamburger-inner,
.hamburger-inner:after,
.hamburger-inner:before {
    position: absolute;
    width: 30px;
    height: 3px;
    transition-timing-function: ease;
    transition-duration: 0.15s;
    transition-property: transform;
    border-radius: 2px;
    background-color: #fff;
}

.hamburger-inner:after,
.hamburger-inner:before {
    display: block;
    content: "";
}

.hamburger-inner:before {
    top: -8px;
}

.hamburger-inner:after {
    bottom: -8px;
}

/* Hamburger elastic animation from portfolio reference */
.hamburger--elastic .hamburger-inner {
    top: 2px;
    transition-duration: 0.275s;
    transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hamburger--elastic .hamburger-inner:before {
    top: 6px;
    transition: opacity 0.125s 0.275s ease;
}

.hamburger--elastic .hamburger-inner:after {
    top: 12px;
    transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hamburger--elastic.is-active .hamburger-inner {
    transform: translate3d(0, 6px, 0) rotate(135deg);
    transition-delay: 0.075s;
}

.hamburger--elastic.is-active .hamburger-inner:before {
    transition-delay: 0s;
    opacity: 0;
}

.hamburger--elastic.is-active .hamburger-inner:after {
    transform: translate3d(0, -12px, 0) rotate(-270deg);
    transition-delay: 0.075s;
}

/* Clean mobile navigation styling based on portfolio reference */
@media only screen and (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .side-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: auto;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
        background: rgba(26, 28, 41, 0.98);
        backdrop-filter: blur(20px);
        z-index: 1000;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .side-nav.active {
        max-height: 240px;
        padding: 16px;
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .container {
        margin-left: 0;
        width: 100vw;
        margin-top: 0;
        transition: margin-top 0.3s ease;
    }

    .container.sidebar-open {
        margin-top: 220px;
    }

    .sidebar-overlay {
        display: none;
    }

    /* Clean navigation links styling */
    .side-nav-links {
        flex-direction: column;
        width: 100%;
        padding: 8px 0 4px 0;
        margin: 0;
        list-style: none;
        display: flex;
        visibility: visible;
        gap: 2px;
    }

    .side-nav-links li {
        margin: 0;
        width: 100%;
        display: block;
        opacity: 1;
        visibility: visible;
        animation: none !important;
        transform: none !important;
    }

    .side-nav-links li a {
        padding: 10px 14px;
        border-radius: 6px;
        width: 100%;
        justify-content: flex-start;
        display: flex;
        align-items: center;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        background: rgba(255, 255, 255, 0.05);
        transition: all 0.2s ease;
        font-size: 14px;
        min-height: 36px;
    }

    .side-nav-links li a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .side-nav-links li a i {
        margin-right: 12px;
        font-size: 16px;
        width: 18px;
        text-align: center;
    }

    .side-nav-links li a p {
        margin: 0;
        font-size: 14px;
    }

    /* Compact logo styling for mobile */
    .logo-nav {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px 0;
        margin-bottom: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        height: 40px;
    }

    .logo-nav-img,
    .logo-nav-icon {
        max-height: 24px;
        opacity: 0.9;
    }


    .logo-nav img {
        opacity: 1;
        visibility: visible;
    }
}

@media only screen and (max-width: 600px) {
    .side-nav.active {
        max-height: 300px;
        padding: 12px;
    }

    .container.sidebar-open {
        margin-top: 260px;
        padding: 10px 10px 10px 10px;
    }

    .logo-nav {
        padding: 6px 0;
        height: 36px;
    }

    .logo-nav-img,
    .logo-nav-icon {
        max-height: 20px;
    }

    .side-nav-links {
        padding: 10px 0 5px 0;
        gap: 1px;
    }

    .side-nav-links li {
        margin: 5px 0;
    }

    .side-nav-links li a {
        padding: 8px 12px;
        font-size: 13px;
        margin-left: 4px;
        margin-right: 4px;
        min-height: 32px;
        border-radius: 4px;
    }

    .side-nav-links li a i {
        font-size: 14px;
        margin-right: 10px;
        width: 16px;
    }

    .side-nav-links li a p {
        font-size: 13px;
    }
}

/* ========================================
   COMPACT TOP BAR
   ======================================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
    min-height: 64px; /* enforce consistent header height across pages */
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    border-radius: 12px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    color: #fff;
    font-size: 1.3em;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.status-pills {
    display: flex;
    gap: 12px;
    border-radius: 12px;
    align-items: center;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.status-time-mini {
    font-size: 0.85em;
    opacity: 0.8;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 101;
}

.control-select-mini {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    z-index: 102;
}

.control-select-mini option {
    background: #2c3e50;
    color: #fff;
}

.toggle-mini {
    position: relative;
    width: 56px;
    height: 24px;
}

.toggle-input {
    display: none;
}

/* Track */
.toggle-label-mini {
    display: block;
    width: 100%;
    height: 100%;
    background: #6b7280;
    /* OFF */
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    transition: background 0.25s ease;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

/* TEXT (default OFF) */
.toggle-label-mini::before {
    content: "OFF";
    position: absolute;
    right: 8px;
    /* 👉 move OFF to RIGHT */
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
    transition: all 0.25s ease;
}

/* Knob */
.toggle-label-mini::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.25s ease;
}

/* ON STATE */
.toggle-input:checked+.toggle-label-mini {
    background: #22c55e;
}

/* ON STATE → move text to LEFT */
.toggle-input:checked+.toggle-label-mini::before {
    content: "ON";
    left: 8px;
    right: auto;
}

/* Move knob */
.toggle-input:checked+.toggle-label-mini::after {
    transform: translateX(32px);
}

.btn-refresh-mini {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.25s ease;
    position: relative;
    z-index: 102;
}

/* 🔄 LOADING */
.btn-refresh-mini.refresh-loading {
    background: #f59e0b;
    /* amber */
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* ✅ DONE */
.btn-refresh-mini.refresh-done {
    background: #10b981;
    /* emerald */
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.btn-refresh-mini:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.btn-refresh-mini:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.update-info-mini {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.6);
    /* allow the label and time to wrap and center vertically */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    white-space: normal;
    padding: 10px 10px; 
}

/* Inline last-update shown next to Data pill on narrow/mobile screens */
.last-update-inline {
    /* match visual style of .status-pill so it vertically centers */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Force exact same height for both pills to avoid visual mismatch */
.status-pill,
.last-update-inline {
    box-sizing: border-box;
    height: 25px; /* explicit height for matching */
    min-height: 25px;
    padding-top: 6px; /* ensure vertical padding matches */
    padding-bottom: 6px;
}

/* On small screens, hide the stacked update info and show inline text */
@media (max-width: 700px) {
    .update-info-mini { display: none !important; }
    .last-update-inline { display: inline-flex !important; }
    /* slightly reduce top-bar spacing to fit inline */
    /* show header inline table info and hide the summary copy */
    .lpr-table-info { display: none !important; }
    .lpr-table-info-inline { display: inline-flex !important; align-items: center; }
}

/* Hide header inline table-info by default (desktop) - only show via media query */
.lpr-table-info-inline {
    display: none;
}

.last-update-inline {
    display: none;
}

/* ========================================
   CONTROLS DISABLED STATE (API/Web disconnected)
   ======================================== */
.controls-disabled .control-select-mini,
.controls-disabled .toggle-label-mini,
.controls-disabled .btn-refresh-mini {
    opacity: 0.4;
    pointer-events: none;
}

.countdown-paused {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* ========================================
   SECTION STYLES
   ======================================== */

.section-cameras {
    padding-left: 10px; 
    padding-right: 10px;
    border-bottom: none;
    background: #fff;
}

.section-title {
    font-size: 0.8em;
    font-weight: 700;
    color: #8e8e8e;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f0f0;
}

/* ========================================
   SECTION 1: HEADER
   ======================================== */
.section-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    text-align: center;
    padding: 32px;
}

.section-header h1 {
    color: #fff;
    font-size: 2.2em;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.section-header .subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1em;
    margin: 0;
}

/* ========================================
   SECTION 2: CONNECTION STATUS
   ======================================== */
.section-status {
    background: #fafafa;
}

.status-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-weight: 700;
    color: #555;
    font-size: 0.95em;
}

.status-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-time {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

.status-ago {
    color: #888;
    font-size: 0.85em;
}

.status-divider {
    width: 1px;
    height: 50px;
    background: #ddd;
}

/* ========================================
   SECTION 3: CONTROLS
   ======================================== */
.section-controls {
    background: #fff;
}

.control-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.control-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-select {
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: border-color 0.2s;
    background: #fff;
}

.control-select:hover,
.control-select:focus {
    border-color: #667eea;
    outline: none;
}

.control-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.9em;
    color: #666;
}

.info-divider {
    color: #ddd;
}

/* ========================================
   SECTION 4: SUMMARY (Now more prominent)
   ======================================== */
.section-summary {
    background: #fff;
    padding: 2px;
    flex-shrink: 0;
    z-index: 999;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.summary-card {
    background: #fff;
    border-radius: 10px;
    padding-top: 7px;
    padding-bottom: 15px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.summary-card.clickable {
    cursor: pointer;
}

.summary-card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.summary-card.clickable:active {
    transform: translateY(-1px);
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.summary-count {
    display: block;
    font-size: 2.5em;
    font-weight: 700;
    line-height: 1; 
}

.summary-label {
    font-size: 0.7em;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-total {
    border-color: #bdc3c7;
    background: #f8f9fa;
}

.summary-total .summary-count {
    color: #2c3e50;
}

.summary-active {
    border-color: #27ae60;
    background: #f0fff4;
}

.summary-active .summary-count {
    color: #27ae60;
}

.summary-diagnostic {
    border-color: #f39c12;
    background: #fffbf0;
}

.summary-diagnostic .summary-count {
    color: #f39c12;
}

.summary-inactive {
    border-color: #e74c3c;
    background: #fff5f5;
}

.summary-inactive .summary-count {
    color: #e74c3c;
}

.summary-warning {
    border-color: #9b59b6;
    background: #faf5ff;
}

.summary-warning .summary-count {
    color: #9b59b6;
}

/* ========================================
   SECTION 5: CAMERA LISTS
   ======================================== */
.section-cameras {
    background: #fff;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    transition: all 5s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateY(0);
    opacity: 1;
}

.section-cameras::-webkit-scrollbar {
    width: 10px;
}

.section-cameras::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.section-cameras::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

.section-cameras::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.dropdown {
    margin-bottom: 12px;
}

.dropdown-btn {
    width: 100%;
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 24px;
    font-size: 1.1em;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.dropdown-btn:hover {
    background: #f0f0f0;
}

.dropdown-icon {
    font-size: 0.8em;
}

/* Status-specific button colors (permanent) */
.dropdown-btn.status-active {
    background: #eafaf1;
    color: #27ae60;
    border-color: #27ae60;
}

.dropdown-btn.status-active .dropdown-icon {
    color: #27ae60;
}

.dropdown-btn.diagnostic {
    background: #fef9e7;
    color: #f39c12;
    border-color: #f39c12;
}

.dropdown-btn.diagnostic .dropdown-icon {
    color: #f39c12;
}

.dropdown-btn.inactive {
    background: #fdedec;
    color: #e74c3c;
    border-color: #e74c3c;
}

.dropdown-btn.inactive .dropdown-icon {
    color: #e74c3c;
}

/* Open state indicator (when dropdown is expanded) */
.dropdown-btn.open {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-content {
    display: none;
    padding: 12px 12px 16px 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-content.show {
    display: block;
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
}

/* Auto-collapse animation */
.dropdown-content.auto-collapsing {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    opacity: 0;
    transform: translateY(-5px);
}

/* ========================================
   TABLE CONTROLS (Search & Info)
   ======================================== */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 16px;
    flex-wrap: wrap;
}

/* Search input wrapper for clear button */
.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.search-input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9em;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Clear button inside search input */
.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #999;
    font-size: 18px;
    font-weight: normal;
    line-height: 1;
    cursor: pointer;
    display: none;
    padding: 4px;
    transition: color 0.2s;
}

.search-clear:hover {
    color: #333;
}

/* Show clear button when input has value */
.search-wrapper:has(.search-input:not(:placeholder-shown)) .search-clear,
.search-wrapper.has-value .search-clear {
    display: flex;
}

.table-info {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

/* ========================================
   SCROLLABLE TABLE CONTAINER
   ======================================== */
.table-scroll {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

.table-scroll.lpr-table {
    flex: 1;
    max-height: none;
    min-height: 0;
}

.section-cameras.lpr-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-cameras.lpr-section .pagination {
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.table-scroll table {
    min-width: 500px;
    /* Ensure table doesn't shrink too much on mobile */
}

.table-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    /* For horizontal scrollbar */
}

.table-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    padding: 8px 16px;
    margin-bottom: 10px;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
}

/* ========================================
   TABLES
   ======================================== */
table {
    border-collapse: collapse;
    width: 100%;
}

thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

th,
td {
    padding: 12px 16px;
    text-align: center;
}

thead {
    background: #f8f9fa;
}

th {
    font-weight: 700;
    font-size: 0.85em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e0e0e0;
}

/* Sortable table headers */
th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
    position: relative;
    padding-right: 28px;
}

/* ========================================
   DASHBOARD / IFRAME RESPONSIVE RULES
   Ensure embedded Grafana panels fill available viewport across devices
   ======================================== */

/* Use a CSS variable for top bar height fallback */
:root { --topbar-height: 84px; }

#grafanaFrame {
    width: 100%;
    height: calc(100vh - var(--topbar-height));
    min-height: 420px;
    display: block;
    border: 0;
}

/* Container around iframe should remove extra padding to maximize viewport */
.container > div[style*="padding"] {
    padding: 8px 8px 12px 8px !important;
}

/* Larger desktops: reduce topbar variable to account for larger paddings */
@media (min-width: 1200px) {
    :root { --topbar-height: 92px; }
    #grafanaFrame { min-height: 560px; }
}

/* Tablets and small laptops */
@media (max-width: 1024px) {
    :root { --topbar-height: 76px; }
    #grafanaFrame { height: calc(100vh - var(--topbar-height)); min-height: 480px; }
}

/* Mobile: collapse sidebar and allow iframe to use almost full viewport */
@media (max-width: 768px) {
    .side-nav { display: none !important; }
    .container { margin-left: 0 !important; width: 100vw !important; }
    :root { --topbar-height: 64px; }

/* Mobile: hide grid/list toggle and expand search to full width */
@media (max-width: 700px) {
    .view-mode { display: none !important; }
    .lpr-controls { width: 100%; justify-content: center; max-width: 700px;}
    .lpr-search { width: 100%; max-width: 720px; }
    .lpr-search-wrapper { width: 100%; }
}
    #grafanaFrame { height: calc(100vh - var(--topbar-height)); min-height: 360px; }
    /* remove container padding to maximize space */
    .container { padding: 6px !important; }
}

/* Honor reduced motion for embedded content */
@media (prefers-reduced-motion: reduce) {
    #grafanaFrame { transition: none !important; }
}

th[data-sort]:hover {
    background: #e8ebf0;
    color: #333;
}

th[data-sort] .sort-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    opacity: 0.3;
}

th[data-sort] .sort-icon::after {
    content: '⇅';
}

th[data-sort].sort-asc {
    background: #e3f2fd;
    color: #1976d2;
}

th[data-sort].sort-asc .sort-icon {
    opacity: 1;
}

th[data-sort].sort-asc .sort-icon::after {
    content: '↑';
}

th[data-sort].sort-desc {
    background: #e3f2fd;
    color: #1976d2;
}

th[data-sort].sort-desc .sort-icon {
    opacity: 1;
}

th[data-sort].sort-desc .sort-icon::after {
    content: '↓';
}

tr:nth-child(even) {
    background: #fafafa;
}

tr:hover {
    background: #f0f4ff;
}

/* ========================================
   STATUS BADGES (Pingable/Snapshotable)
   ======================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.status-yes {
    background: #d4edda;
    color: #155724;
}

.status-no {
    background: #f8d7da;
    color: #721c24;
}

/* ========================================
   CAMERA THUMBNAIL IMAGES
   ======================================== */
.image-cell {
    text-align: center;
    padding: 6px !important;
}

.camera-thumbnail {
    max-width: 120px;
    max-height: 80px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid #e0e0e0;
    object-fit: cover;
}

.camera-thumbnail:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.no-image {
    color: #999;
    font-size: 0.85em;
    font-style: italic;
}

.thumbnail-error {
    display: inline-block;
    padding: 8px 12px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
    font-size: 0.75em;
}

/* ========================================
   IMAGE MODAL (Fullscreen View)
   ======================================== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    /* Make modal focusable for keyboard events */
    outline: none;
}

/* Smooth show/hide using opacity and parent "visible" class */
.image-modal {
    opacity: 0;
    transition: opacity 180ms ease;
    will-change: opacity;
}
.image-modal.visible {
    opacity: 1;
}

.modal-content {
    position: relative;
    max-width: 85vw;
    /* Further reduced to allow for larger padding */
    max-height: 85vh;
    /* Further reduced to allow for larger padding */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Tuned padding for better fit and responsiveness */
    padding: 40px 36px 28px 36px;
    /* top right bottom left */
}

/* Subtle scale-in for modal content for buttery feel */
.image-modal .modal-content {
    transform: scale(0.9875);
    transition: transform 160ms cubic-bezier(0.2,0.9,0.2,1), opacity 160ms ease;
}
.image-modal.visible .modal-content {
    transform: scale(1);
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: fixed;
    right: -20px;
    top: -30px;
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    /* Touch-friendly size */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover,
.modal-close:active {
    color: #e74c3c;
}

#modalCaption {
    color: #fff;
    margin-top: 3px;
    padding-top: 2px;
    font-size: 1.1em;
    font-weight: 600;
    z-index: 40;
    align-self: center;
}

.modal-content img {
    margin-bottom: 3px;
}

.modal-overlay-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.overlay-pill {
    position: absolute;
    background: rgba(0, 0, 0, 0.65);
    padding: 6px 10px;
    border-radius: 999px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    max-width: calc(100% - 40px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overlay-bottom-left {
    bottom: 8px;
    left: 8px;
}

.overlay-bottom-right {
    bottom: 8px;
    right: 8px;
}

/* Small annotation shown on thumbnails in overall tab (match LPR modal sizing) */
.thumb-container {
    position: relative;
    display: inline-block;
}

/* Modal overlay text (car/plate) — keep small and subtle like LPR monitoring */
.modal-overlay-text .overlay-left,
.modal-overlay-text .overlay-right {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
    position: absolute;
    top: 12px;
    opacity: 0;
    transition: opacity 200ms ease;
}

.modal-overlay-text .overlay-left {
    left: 16px;
}

.modal-overlay-text .overlay-right {
    right: 16px;
}

.image-modal.visible .modal-overlay-text .overlay-left,
.image-modal.visible .modal-overlay-text .overlay-right {
    opacity: 1;
}

/* Spinner animation */
#modalSpinner {
    display: none;
    font-weight: 700;
    letter-spacing: 0.02em;
    animation: spinnerPulse 1s linear infinite;
}
@keyframes spinnerPulse {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

/* ========================================
   MOBILE: Bottom Nav, Responsive Table, Skeleton
   ======================================== */
@media (max-width: 768px) {

    .pagination {
        display: none !important;
    }

    /* ========================================
       NAV CONTAINER (GLASS + FLOATING)
    ======================================== */
    .bottom-nav {
        position: fixed;
        left: 6px;
        right: 6px;
        bottom: 0;

        height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-around;
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);

        /* OPTIONAL: stronger separation */
        box-shadow:
            0 -2px 6px rgba(0, 0, 0, 0.06),
            /* 👈 divider shadow */
            0 8px 24px rgba(2, 6, 23, 0.12),
            0 2px 8px rgba(2, 6, 23, 0.08);

        z-index: 99999 !important;
    }

    /* ========================================
       NAV ITEM
    ======================================== */
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        padding: 2px 0;
        text-decoration: none;
        font-size: 10px;
        color: #94a3b8;
        border-radius: 10px;
        position: relative;
        transition:
                background 0.25s ease,
                color 0.25s ease,
                transform 0.2s ease;
    }

    /* ICON */
    .bottom-nav-icon {
        font-size: 20px;
        transition: all 0.2s ease;
    }

    /* LABEL */
    .bottom-nav-label {
        font-size: 8px;
        line-height: 1;
    }

    .bottom-nav-icon
    .bottom-nav-label {
        transition:
            transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
            color 0.25s ease,
            opacity 0.2s ease;
    }

    /* ========================================
       HOVER (SUBTLE)
    ======================================== */
    .bottom-nav-item:hover {
        color: #6366f1;
        background: rgba(99, 102, 241, 0.08);
    }

    /* ========================================
       ACTIVE (MAIN FOCUS)
    ======================================== */
    .bottom-nav-item.active {
        color: transparent;
    }

    .bottom-nav-item.active .bottom-nav-icon {
        transform: translateY(-2px) scale(1.1);
        color: #7551aa; 
    }
    
    .bottom-nav-item.active .bottom-nav-label {
        transform: translateY(-1px) scale(1.1);
        color: #7551aa;
        font-weight: 500; 
    }

    /* 🔥 ACTIVE INDICATOR BAR */
    .bottom-nav-item.active::after {
        content: "";
        position: absolute;
        bottom: -5px;
        width: 28%;
        height: 2px;

        background: linear-gradient(90deg, #6366f1, #8b5cf6);
        border-radius: 999px;

        box-shadow: 0 0 6px rgba(99, 102, 241, 0.6);
    }


    /* ========================================
       GRID CLIPPING FIX (IMPORTANT)
    ======================================== */
    .section-cameras.lpr-section {
        padding-bottom: 51px;
        overflow: hidden;
    }
}

/* Table loading skeleton */
.table-skeleton { display: none; }
.table-skeleton.visible { display: block; }
.skeleton-row { height: 72px; background: linear-gradient(90deg,#f1f5f9 25%, #e9eef6 50%, #f1f5f9 75%); background-size: 200% 100%; animation: skeletonShimmer 1.1s linear infinite; border-radius:8px; margin:10px 0; }
@keyframes skeletonShimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* Card grid (desktop and tablet) */
.cards-grid {
    display: grid;
    /* Max 5 columns on very wide screens */
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    text-align: center;
    align-items: stretch;
    background: #ffffff; /* bright container to match page */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(2,6,23,0.06);
}
.cards-grid .card {
    background: #ffffff; /* bright card */
    color: #0f172a; /* dark text */
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    box-shadow: 0 6px 18px rgba(2,6,23,0.06);
    border: 1px solid rgba(15,23,42,0.06);
}
.card .card-thumb-wrap { background: rgba(255,255,255,0.02); padding: 8px; display:flex; align-items:center; justify-content:center; }
.card img.card-thumb { width:100%; height:200px; object-fit:cover; display:block; border-radius:4px; }
.card .card-thumb-wrap { position: relative; }

/* Hover overlay with action buttons */
.card .thumb-overlay {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    pointer-events: none;
}
.card .thumb-overlay .overlay-actions {
    pointer-events: auto;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 180ms ease, transform 200ms ease;
    transform: translateY(6px);
}
.card:hover .thumb-overlay .overlay-actions,
.card:focus-within .thumb-overlay .overlay-actions {
    opacity: 1;
    transform: translateY(0);
}
.overlay-btn {
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}
.overlay-btn:focus { outline: 2px solid rgba(255,255,255,0.2); }
.card .card-meta { padding: 10px 12px; font-size: 13px; color: #234055; flex:1; }
.card .card-meta .meta-row { display:flex; justify-content:space-between; gap:8px; margin-bottom:8px; }
.card .card-meta .meta-top { display:flex; justify-content:space-between; align-items:center; border-bottom: 1px solid rgba(15,23,42,0.04); margin-bottom: 5px ; padding-bottom: 5px; }
.card .card-meta .meta-top .meta-left { color: #334155; font-size: 15px; text-align: left; display: block; font-weight: 700; }
.card .card-meta .meta-top .meta-right { color: #0f172a; font-weight:700; font-size: 22px}
.card .card-footer { padding:8px 12px; background: #f1f5f9; font-size:12px; color:#0f172a; display:flex; justify-content:center; align-items:center; }
.card .card-footer .footer-actions { display:inline-block; gap:8px; }
.card .card-footer .footer-actions button { background: #ffffff; border:1px solid rgba(15,23,42,0.06); color:#0f172a; padding:6px 8px; border-radius:12px; cursor:pointer; align-items: center; display: inline-block;}
.card .card-footer .footer-actions button:focus { outline:1px  solid rgba(15,23,42,0.08); }


@media (max-width: 1820px) {
    .cards-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1200px) {
    .cards-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .cards-grid { grid-template-columns: repeat(1, 1fr); }
}



/* ========================================
   LIVE INDICATOR (Status Dots)
   ======================================== */
.live-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    vertical-align: middle;
    animation: pulse 1.5s ease-in-out infinite;
}

.live-indicator.connected {
    background-color: #27ae60;
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
}

.live-indicator.disconnected {
    background-color: #e74c3c;
    box-shadow: 0 0 6px rgba(231, 76, 60, 0.6);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-refresh {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1em;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-refresh:active {
    transform: scale(0.98);
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #95a5a6;
    box-shadow: none;
    transform: none;
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */
.toggle-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    width: 54px;
    height: 28px;
    background: #ccc;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: background 0.3s;
    display: inline-block;
}

.toggle-label::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked+.toggle-label {
    background: #27ae60;
}

.toggle-input:checked+.toggle-label::before {
    left: 28px;
}

.toggle-status {
    font-size: 0.75em;
    font-weight: 700;
    color: #888;
}

/* ========================================
   PROGRESS CONTAINER (Compact inline bar)
   ======================================== */
.progress-container {
    display: none;
    padding: 14px 24px 16px 24px;
    background: linear-gradient(135deg, #e8f4fc 0%, #f0f8ff 100%);
    border-bottom: 1px solid #d1e7dd;
    flex-shrink: 0;
    z-index: 1050;
    position: relative;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    border-top: 2px solid rgba(102, 126, 234, 0.2);
    margin: 8px 0 12px 0;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.progress-container.active {
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1050;
    animation: slideDown 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-top-color: rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #e3f2fd 0%, #f8fbff 100%);
    transform: translateY(0);
    opacity: 1;
}

/* Add smooth slide animation for progress bar */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }

    50% {
        opacity: 0.7;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 80px;
    }
}

.progress-text {
    font-weight: 600;
    font-size: 0.85em;
    color: #2c3e50;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.progress-bar-wrapper {
    flex: 1;
    height: 12px;
    background: #e8e9ea;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(102, 126, 234, 0.2);
    position: relative;
}

.progress-bar-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right,
            rgba(102, 126, 234, 0.05) 0%,
            rgba(102, 126, 234, 0.1) 50%,
            rgba(102, 126, 234, 0.05) 100%);
    animation: backgroundPulse 2s ease-in-out infinite;
}

@keyframes backgroundPulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.6;
    }
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.4s ease;
    position: relative;
    box-shadow:
        0 2px 4px rgba(102, 126, 234, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
    z-index: 1;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.4) 50%,
            transparent 100%);
    animation: shimmer 1.2s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-percent {
    font-weight: 700;
    font-size: 0.85em;
    color: #667eea;
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* ========================================
   DISABLED STATES
   ======================================== */
.controls-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.control-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#autoRefreshToggle:disabled+.toggle-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */



/* =========================
   📱 MOBILE (<=768px)
========================= */
@media (max-width: 768px) {

    /* =========================
       TOP BAR BASE
    ========================= */

    .top-bar .top-bar-left .status-pills {
        display: none !important;
    }

    .top-bar-left {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .top-bar {
        padding: 10px;
        justify-content: center;
    }

    /* =========================
       📊 TABLE SECTION
    ========================= */
    .section-cameras {
        height: calc(100vh - 60px);
        overflow-y: auto;
    }

    /* =========================
       SEARCH
    ========================= */
    .lpr-search-wrapper {
        margin: 10px;
    }

    .lpr-search-icon {
        left: 12px; 
    }

    .lpr-search {
        margin: 0;
    }

    /* =========================
       CARDS / TABLE
    ========================= */
    th,
    td {
        padding: 10px 8px;
        font-size: 0.85em;
    }

    /* =========================
       PAGINATION
    ========================= */
    .pagination {
        gap: 4px;
    }

    .page-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .page-info {
        font-size: 0.8em;
    }

}


/* Small mobile phones */
@media (max-width: 480px) {

    html,
    body {
        overflow-x: hidden;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .summary-card {
        padding: 10px 6px;
    }

    .summary-count {
        font-size: 1.8em;
    }

    .summary-label {
        font-size: 0.6em;
    }

    .top-bar-right {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .top-bar-left {
        flex-direction: column;
        gap: 8px;
    }

    /* Countdown/Last update on mobile - full width row */
    .update-info-mini {
        width: 100%;
        text-align: center;
        font-size: 0.7em;
        padding: 4px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 4px;
    }

    .section-title {
        font-size: 0.7em;
    }

    .section-summary,
    .section-cameras {
        padding: 2px;
    }

    /* Smaller table cells for mobile but keep all columns visible */
    th,
    td {
        padding: 8px 6px;
        font-size: 0.75em;
        white-space: nowrap;
    }

    .dropdown-btn {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .dropdown-icon {
        font-size: 0.8em;
    }

    /* Pagination compact */
    .page-btn {
        padding: 5px 8px;
        font-size: 0.75em;
    }

    /* Hide First/Last buttons on mobile */
    .pagination .page-btn:first-child,
    .pagination .page-btn:last-child {
        display: none;
    }

    /* Sort icons smaller */
    th[data-sort] {
        padding-right: 20px;
    }

    th[data-sort] .sort-icon {
        right: 4px;
        font-size: 0.7em;
    }

    /* Camera thumbnail smaller on mobile */
    .camera-thumbnail {
        max-width: 80px;
        max-height: 50px;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .logo {
        font-size: 1em;
    }

    .status-pills {
        flex-direction: column;
        gap: 4px;
    }

    .summary-count {
        font-size: 1.5em;
    }

    .btn-refresh-mini {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .control-select-mini {
        padding: 5px 8px;
        font-size: 0.8em;
    }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .summary-card {
        padding: 8px 6px;
    }

    .summary-count {
        font-size: 1.5em;
    }

    .summary-label {
        font-size: 0.6em;
    }

    .section-summary {
        padding: 8px 12px;
    }

    .table-scroll {
        max-height: 150px;
    }

    .table-scroll.lpr-table {
        flex: 1;
        max-height: none;
        min-height: 0;
    }
}

/* Enhanced Mobile Navigation Experience with Smooth Animations */
@media only screen and (max-width: 768px) {

    .side-nav-links li a:hover,
    .side-nav-links li a:active {
        background: rgba(255, 255, 255, 0.15) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .side-nav-links li a:active {
        transform: translateY(0);
        transition: all 0.1s ease;
    }

    /* Ensure critical navigation visibility */
    .side-nav-links li {
        animation: none !important;
        animation-delay: 0s !important;
        display: block !important;
    }

    .side-nav-links li a {
        animation: none !important;
        transform: none !important;
        display: flex !important;
    }
}

/* Keyframe animations for smooth mobile navigation */
@keyframes slideInFromTop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInContent {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced hamburger micro-interactions */
@media only screen and (max-width: 768px) {
    .hamburger:hover span {
        background: linear-gradient(90deg, #ffffff 0%, #e8f4fd 100%);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        transform: scaleY(1.2);
    }

    .side-nav.active .side-nav-links li {
        animation: fadeInContent 0.6s ease forwards;
    }

    .side-nav.active .side-nav-links li:nth-child(1) {
        animation-delay: 0.1s;
    }

    .side-nav.active .side-nav-links li:nth-child(2) {
        animation-delay: 0.15s;
    }

    .side-nav.active .side-nav-links li:nth-child(3) {
        animation-delay: 0.2s;
    }

    .side-nav.active .side-nav-links li:nth-child(4) {
        animation-delay: 0.25s;
    }

    /* Enhanced focus states for accessibility */
    .hamburger:focus {
        outline: 2px solid rgba(102, 126, 234, 0.8);
        outline-offset: 4px;
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.4),
            0 4px 12px rgba(0, 0, 0, 0.3), \n 0 0 0 4px rgba(102, 126, 234, 0.2);
    }

    .side-nav-links li a:focus {
        outline: 2px solid rgba(102, 126, 234, 0.8);
        outline-offset: 2px;
        background: rgba(102, 126, 234, 0.2) !important;
    }
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 40px 35px;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.login-logo-icon {
    font-size: 42px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-field label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-field label i {
    color: #667eea;
    font-size: 14px;
}

.login-field input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    color: #1f2937;
    background: #f9fafb;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.login-field input::placeholder {
    color: #9ca3af;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: #667eea;
}

.login-error {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
}

.login-error.show {
    display: flex;
}

.login-error i {
    font-size: 16px;
}

.login-btn {
    width: 100%;
    padding: 16px 24px;
    background: #1e293b;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.login-btn:hover:not(:disabled) {
    background: #334155;
}

.login-btn:active:not(:disabled) {
    background: #475569;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-btn.success {
    background: #22c55e;
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.login-footer p {
    color: #9ca3af;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
}

.login-footer i {
    color: #64748b;
}

/* Logout button in sidebar */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-top: 0;
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.sidebar-logout-btn span {
    transition: opacity 0.3s ease,
        max-width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 100px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-logout-btn:hover {
    background: #e74c3c;
    color: #fff;
}

/* ========================================
   COLLAPSED SIDEBAR STATE
   ======================================== */
.side-nav.collapsed {
    width: 72px;
    padding: 15px 10px;
}

.side-nav.collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.side-nav.collapsed .logo-nav {
    justify-content: center;
    width: 100%;
}

.side-nav.collapsed .logo-nav-icon {
    display: none;
}

.side-nav.collapsed .logo-nav-img {
    width: 36px;
    height: 36px;
}

.side-nav.collapsed .sidebar-collapse-btn {
    padding-left: 25px;
    width: 46px;
    height: 46px;
    margin: auto auto 8px;
    border-radius: 12px;
}

.side-nav.collapsed .sidebar-collapse-btn span {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
}

.side-nav.collapsed .side-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.side-nav.collapsed .side-nav-links li {
    width: 100%;
    display: flex;
    justify-content: center;
}

.side-nav.collapsed .side-nav-links li a {
    justify-content: center;
    padding: 12px;
    width: 46px;
    height: 46px;
    position: relative;
    border-left: none;
    border-radius: 12px;
    gap: 0;
}

.side-nav.collapsed .side-nav-links li.current a {
    border-left: none;
    background: rgba(102, 126, 234, 0.25);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.side-nav.collapsed .side-nav-links li a i {
    font-size: 20px;
    width: auto;
    margin: 0;
}

.side-nav.collapsed .side-nav-links li a p {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    position: absolute;
}

/* Collapsed tooltips */
.side-nav.collapsed .side-nav-links li a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 15px;
    padding: 8px 14px;
    background: #1e293b;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.side-nav.collapsed .side-nav-links li a[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    border: 6px solid transparent;
    border-right-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.side-nav.collapsed .side-nav-links li a:hover::after,
.side-nav.collapsed .side-nav-links li a:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Collapsed logout button */
.side-nav.collapsed .sidebar-logout-btn {
    padding: 10px;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0 auto;
    border-radius: 12px;
}

.side-nav.collapsed .sidebar-logout-btn span {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    position: absolute;
}

.side-nav.collapsed .sidebar-logout-btn i {
    font-size: 16px;
    margin: 0;
}

/* JS-inserted tooltip for collapsed sidebar (fallback to CSS pseudo tooltip) */
.collapsed-tooltip {
    position: fixed;
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    z-index: 1100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 160ms ease;
}

/* Smooth transitions for collapsed/expanded sidebar elements */
.side-nav .sidebar-header {
    transition: gap 0.25s ease, padding 0.25s ease;
}

.side-nav .logo-nav-img {
    transition: width 0.25s ease, height 0.25s ease, transform 0.2s ease;
}

.sidebar-collapse-btn span {
    transition: opacity 0.18s ease, max-width 0.25s ease;
}

.side-nav .side-nav-links li a {
    transition: background 0.18s ease, padding 0.18s ease, width 0.18s ease, height 0.18s ease, transform 0.18s ease;
}

.side-nav .side-nav-links li a:hover {
    transform: translateY(-3px);
}

.side-nav .side-nav-links li a p {
    transition: opacity 0.18s ease, max-width 0.18s ease;
}

.sidebar-logout-btn span {
    transition: opacity 0.18s ease, max-width 0.25s ease;
}

.collapsed-tooltip {
    transition: opacity 160ms ease, transform 120ms ease;
}

.collapsed-tooltip.show {
    opacity: 1;
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 25px;
        border-radius: 20px;
    }

    .login-logo h1 {
        font-size: 24px;
    }
}