:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-sidebar: #1e293b;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 16px 16px 8px;
    margin-top: 16px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    min-height: 100vh;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-size: 18px;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 16px 24px;
    text-align: left;
}

th {
    background: var(--bg-card-hover);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.col-6 {
    flex: 0 0 calc(50% - 12px);
}

.col-4 {
    flex: 0 0 calc(33.333% - 16px);
}

.col-8 {
    flex: 0 0 calc(66.666% - 8px);
}

.col-12 {
    flex: 0 0 100%;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--secondary);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

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

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Activity List */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.usage {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.activity-icon.incident {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.activity-desc {
    font-size: 13px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 44px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive - Large Tablets and Small Desktops */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .col-8 {
        flex: 0 0 100%;
    }

    .col-4 {
        flex: 0 0 100%;
    }
}

/* Responsive - Tablets */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 16px;
    }

    .sidebar-header {
        flex-direction: column;
        text-align: center;
    }

    .sidebar-title,
    .sidebar-subtitle,
    .nav-section,
    .nav-link span {
        display: none;
    }

    .sidebar-logo {
        width: 48px;
        height: 48px;
        margin: 0 auto;
    }

    .nav-link {
        justify-content: center;
        padding: 14px;
    }

    .nav-link i {
        width: auto;
        font-size: 20px;
    }

    .main-content {
        margin-left: 80px;
        padding: 24px;
    }

    .sidebar-footer {
        left: 12px;
        right: 12px;
    }

    .user-info {
        flex-direction: column;
        text-align: center;
    }

    .user-name,
    .user-role {
        display: none;
    }

    .user-info>a {
        margin-top: 8px;
    }

    .col-6,
    .col-4,
    .col-8 {
        flex: 0 0 100%;
    }

    .table-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    th,
    td {
        padding: 12px 16px;
    }
}

/* Responsive - Small Tablets and Large Phones */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        padding: 24px;
        transition: var(--transition);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-header {
        flex-direction: row;
        text-align: left;
    }

    .sidebar-title,
    .sidebar-subtitle,
    .nav-section,
    .nav-link span {
        display: block;
    }

    .nav-link {
        justify-content: flex-start;
        padding: 12px 16px;
    }

    .sidebar-footer {
        left: 24px;
        right: 24px;
    }

    .user-info {
        flex-direction: row;
        text-align: left;
    }

    .user-name,
    .user-role {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 70px 16px 24px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-title {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 28px;
    }

    .table-container {
        border: none;
        background: transparent;
        overflow: visible;
        margin: 0;
    }

    table {
        min-width: 100%;
    }

    /* Mobile Table Card View */
    thead {
        display: none;
    }

    tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
    }

    tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    tbody td:first-child {
        padding-top: 0;
    }

    tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 16px;
        text-align: left;
        flex: 1;
    }

    /* Content alignment */
    tbody td>* {
        text-align: right;
    }

    /* Specific adjustments */
    tbody td .badge {
        margin-left: auto;
    }

    tbody td .action-buttons {
        justify-content: flex-end;
        width: auto;
        margin-left: auto;
    }

    .card {
        padding: 20px;
    }

    .filters {
        flex-direction: column;
    }

    .filter-item {
        min-width: 100%;
    }

    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    .modal {
        width: 95%;
        margin: 16px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

/* Responsive - Mobile Phones */
@media (max-width: 480px) {
    .main-content {
        padding: 60px 12px 20px;
    }

    .page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-label {
        font-size: 13px;
    }

    .table-title {
        font-size: 16px;
    }

    .card-title {
        font-size: 14px;
    }

    th,
    td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .badge {
        padding: 3px 8px;
        font-size: 11px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .action-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .action-buttons .btn {
        flex: 1;
    }

    .login-card {
        padding: 24px;
    }

    .login-logo {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .login-title {
        font-size: 20px;
    }

    .form-control {
        padding: 10px 14px;
        font-size: 14px;
    }

    .activity-item {
        flex-direction: column;
        gap: 12px;
    }

    .activity-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .alert {
        padding: 12px 16px;
        font-size: 13px;
    }

    .pagination {
        padding: 16px 8px;
        flex-wrap: wrap;
    }

    .page-link {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Chart Container */
.chart-container {
    height: 300px;
    margin-top: 16px;
}

/* User Info in Sidebar */
.sidebar-footer {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.page-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover,
.page-link.active {
    background: var(--primary);
    color: white;
}

/* Print Styles */
@media print {

    .sidebar,
    .btn,
    .action-buttons {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    body {
        background: white;
        color: black;
    }

    .card,
    .table-container {
        background: white;
        border: 1px solid #ddd;
    }
}