:root {
    /* Brand Colors */
    --acn-blue: #0B5ED7;
    --acn-orange: #FF6A00;
    --acn-blue-rgb: 11, 94, 215;
    --acn-orange-rgb: 255, 106, 0;

    /* Layout Colors (Light Mode Default) */
    --bg-gradient: radial-gradient(circle at 10% 20%, rgba(216, 241, 230, 0.46) 0.1%, rgba(233, 226, 226, 0.28) 90.1%);
    --bg-page: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --sidebar-width: 260px;
    --header-height: 70px;
}

[data-theme="dark"] {
    --bg-page: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-page);
    background-image:
        radial-gradient(at 0% 0%, rgba(var(--acn-blue-rgb), 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(var(--acn-orange-rgb), 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Glassmorphism Utilities */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.glass-button {
    background: rgba(var(--acn-blue-rgb), 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(var(--acn-blue-rgb), 0.2);
    border-radius: 12px;
    padding: 10px 20px;
    color: var(--acn-blue);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-button.primary {
    background: var(--acn-orange);
    border: none;
    color: white;
}

.glass-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--acn-blue-rgb), 0.2);
}

.glass-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(1);
}

.glass-button.icon-btn {
    padding: 8px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-button.icon-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.glass-button.icon-btn i {
    font-size: 16px;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    padding-top: calc(var(--header-height) + 24px);
    min-height: 100vh;
}

.header {
    height: var(--header-height);
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 99;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

/* Sidebar Elements */
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-container h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--acn-blue);
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(var(--acn-blue-rgb), 0.05);
    color: var(--acn-blue);
}

.nav-link.active {
    background: var(--acn-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(var(--acn-blue-rgb), 0.3);
}

.nav-link i {
    font-size: 1.2rem;
}

/* Header Elements */
.search-bar {
    position: relative;
    width: 300px;
}

.search-bar input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.4);
    outline: none;
    transition: all 0.3s ease;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.glass-input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.glass-input:focus {
    border-color: var(--acn-blue) !important;
    box-shadow: 0 0 0 4px rgba(var(--acn-blue-rgb), 0.15);
    background: rgba(255, 255, 255, 0.6);
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.modal-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.eye-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s ease;
    z-index: 5;
}

.eye-toggle:hover {
    color: var(--acn-blue);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--acn-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(var(--acn-blue-rgb), 0.15);
    background: rgba(255, 255, 255, 0.8);
}

.stat-card.orange::after {
    background: radial-gradient(circle, rgba(var(--acn-orange-rgb), 0.1) 0%, transparent 70%);
}

.stat-card.orange:hover {
    box-shadow: 0 12px 40px rgba(var(--acn-orange-rgb), 0.15);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 8px 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Tables and Action Column */
.table-container {
    padding: 24px;
    margin-top: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 18px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}

tr {
    transition: background 0.2s ease;
}

tr:hover {
    background: rgba(var(--acn-blue-rgb), 0.02);
}

.action-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.action-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.6);
    padding: 0;
}

.action-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
    display: block;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn:hover svg {
    transform: scale(1.1);
}

.action-btn.view {
    color: var(--acn-blue);
    background: rgba(11, 94, 215, 0.1);
}

.action-btn.view:hover {
    background: var(--acn-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(11, 94, 215, 0.4);
}

.action-btn.edit {
    color: var(--acn-orange);
    background: rgba(255, 106, 0, 0.1);
}

.action-btn.edit:hover {
    background: var(--acn-orange);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 106, 0, 0.4);
}

.action-btn.delete {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.action-btn.delete:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.action-btn.recharge {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.action-btn.recharge:hover {
    background: #22c55e;
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.status-active {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-expired {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#content-area>div {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--acn-blue-rgb), 0.1);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.login-hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out forwards;
    min-width: 250px;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Ripple Effect */
.ripple {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Utils */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--acn-blue);
    font-weight: 600;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--acn-blue) !important;
    box-shadow: 0 0 0 4px rgba(var(--acn-blue-rgb), 0.1);
    outline: none;

    /* Responsive Design */
    @media (max-width: 1024px) {
        :root {
            --sidebar-width: 80px;
        }

        .sidebar {
            padding: 16px;
        }

        .logo-container h2,
        .nav-link span {
            display: none;
        }

        .nav-link {
            justify-content: center;
            padding: 12px;
        }

        .main-content {
            margin-left: var(--sidebar-width);
        }

        .header {
            left: var(--sidebar-width);
        }
    }

    @media (max-width: 768px) {
        :root {
            --sidebar-width: 260px;
            /* Full width when open on mobile */
        }

        body {
            font-size: clamp(14px, 2vw, 16px);
        }

        .sidebar {
            left: -100%;
            transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
        }

        .sidebar.active {
            left: 0;
        }

        #sidebar-toggle {
            display: flex !important;
        }

        .main-content {
            margin-left: 0;
            padding: 16px;
            padding-top: calc(var(--header-height) + 16px);
        }

        .header {
            left: 0;
            padding: 0 16px;
        }

        .search-bar {
            width: 160px;
        }

        .stats-grid {
            grid-template-columns: 1fr;
            gap: 16px;
        }

        .stat-card {
            padding: 16px;
        }

        .glass-card {
            padding: 16px !important;
        }

        /* Table Responsiveness */
        .table-container {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            margin: 0 -16px;
            padding: 0 16px;
        }

        table {
            min-width: 800px;
            /* Force scroll on small screens */
        }

        /* Chart Responsiveness */
        canvas {
            max-width: 100% !important;
            height: auto !important;
        }

        .modal-content {
            width: 95% !important;
            margin: 10px;
            padding: 20px !important;
        }

        .stats-container {
            flex-direction: column;
        }

        /* Global text overflow protection */
        * {
            word-break: break-word;
            overflow-wrap: anywhere;
        }
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }
}