:root {
    --bg-dark: #0a0a0c;
    --bg-card: #141417;
    --sidebar-bg: #0f0f12;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --danger: #ef4444;
    --font-main: 'Outfit', sans-serif;
    --transition-fast: 0.2s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}


.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.75rem;
    position: relative;
    z-index: 10;
    transition: width var(--transition-slow);
}

.sidebar:hover {
    width: 260px;
}

/* 1. Base states for HD (Above 1024px) */
.sidebar-header .logo span,
.nav-links li span {
    opacity: 1;
}

.nav-category span,
.sidebar-footer p,
.group-chevron {
    opacity: 0.6;
}

/* 2. Mini state (Below 1024px) - Shrink and hide labels */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    /* Hide labels when NOT hovered in mini mode */
    .sidebar:not(:hover) .sidebar-header .logo span,
    .sidebar:not(:hover) .nav-links li span,
    .sidebar:not(:hover) .nav-category span,
    .sidebar:not(:hover) .sidebar-footer p,
    .sidebar:not(:hover) .group-chevron {
        opacity: 0 !important;
    }
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    letter-spacing: -0.5px;
}

.sidebar-header .logo span {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}


.sidebar-header .logo i {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    color: white;
    padding: 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

/* Category Headers */
.nav-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1.25rem;
    padding: 0.75rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.nav-category:hover {
    background: rgba(255, 255, 255, 0.03);
}

.nav-category span {
    white-space: nowrap;
    transition: opacity 0.2s ease;
    flex: 1;
}


.nav-category i:first-child {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.group-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}


.nav-group.active .group-chevron {
    transform: rotate(180deg);
}

/* Group Content Animation */
.group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-group.active .group-content {
    max-height: 500px;
    /* Large enough to fit items */
}

/* In mini mode, we force group-content to be hidden unless sidebar is hovered OR we just hide labels */
.nav-links li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.65rem;
    margin-bottom: 0.25rem;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-links li span {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}


.nav-links li i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nav-links li:hover i {
    transform: scale(1.1);
}

.nav-links li.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-footer p {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}


/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent);
}

.content-header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 12, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-center {
    flex: 1;
    max-width: 800px;
    margin: 0 1.5rem;
}

.quick-nav {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-icon-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-icon-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-icon-btn.active {
    background: var(--accent);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.nav-icon-btn i {
    width: 16px;
    height: 16px;
}

.nav-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.5rem;
    align-self: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.clock-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: monospace;
}

#clock-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

#clock-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.dot {
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

.tool-section {
    padding: 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input,
select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition-fast);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.btn {
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-chart {
    height: 60px;
    width: 100%;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.action-btn i {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-table td {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.result-table td:first-child {
    color: var(--text-secondary);
    font-weight: 500;
    width: 40%;
}

.result-table td:last-child {
    text-align: right;
    font-family: monospace;
    color: var(--text-primary);
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1000px) {
    .clock-box {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
        padding: 1rem;
    }

    .sidebar-header .logo span,
    .nav-links li span,
    .sidebar-footer,
    .nav-category {
        display: none;
    }

    .nav-links li {
        justify-content: center;
        padding: 1rem;
    }

    .header-center {
        display: none;
    }

    .content-header {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Usage Bars for Dashboard */
.usage-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    height: 8px;
    border-radius: 4px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.usage-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.5s ease;
}

.usage-bar.warning {
    background: #f59e0b;
}

.usage-bar.danger {
    background: #ef4444;
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}


/* Settings Tabs Styles */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    overflow-x: auto;
}

.settings-tab-btn {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.settings-tab-btn i {
    width: 16px;
    height: 16px;
}

.settings-tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.settings-tab-btn.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border-color: rgba(59, 130, 246, 0.2);
}

.settings-pane {
    display: none;
    animation: slideIn 0.3s ease-out;
}

.settings-pane.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(5px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.setting-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.setting-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.setting-card h4 {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Historic & Reports Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.data-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo-auth {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.auth-header .logo-auth i {
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    color: white;
    padding: 8px;
    border-radius: 10px;
}

.auth-toggle {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-toggle span {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
}

.auth-toggle span:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}