@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #e8ebf0; /* Aluminium base */
    --text-main: #2d3136;
    --text-muted: #6b7280;
    --surface: linear-gradient(145deg, #ffffff, #e6e9ee); /* Metallic surface */
    --border-color: #cfd6e0;
    --surface-shadow: 5px 5px 15px rgba(184, 191, 201, 0.6), -5px -5px 15px rgba(255, 255, 255, 0.9);
    --inner-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.9);
    
    --primary: #000000;
    --primary-hover: #333333;
    
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --info: #32ade6;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    overflow-y: scroll; /* Prevents layout shifting when scrollbar appears */
}

/* Aluminium Utilities */
.glass-panel, .glass-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--surface-shadow);
    border-radius: var(--radius-md);
    box-shadow: var(--surface-shadow), var(--inner-highlight);
    transition: all 0.3s ease;
    min-width: 0; /* Prevents grid blowout */
    max-width: 100%;
}

.glass-card {
    padding: 24px;
}
.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 8px 8px 20px rgba(184, 191, 201, 0.7), -8px -8px 20px rgba(255, 255, 255, 1), var(--inner-highlight);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    box-shadow: 5px 0 20px rgba(184, 191, 201, 0.4);
    padding: 32px 20px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-radius: 0 35px 35px 0;
}

/* Hide scrollbars in nav menu */
.nav-menu::-webkit-scrollbar {
    display: none;
}
.nav-menu {
    list-style: none;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    gap: 12px;
}

.nav-link:hover, .nav-link.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #ffffff;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    font-weight: 500;
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.btn-secondary {
    background: #e5e5ea;
    color: var(--text-main);
}
.btn-secondary:hover {
    background: #d1d1d6;
}

.btn-danger {
    background: #ffe5e5;
    color: var(--danger);
}
.btn-danger:hover {
    background: #ffcccc;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: #f8fafc;
    box-shadow: inset 2px 2px 5px rgba(184, 191, 201, 0.4), inset -2px -2px 5px rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: inset 1px 1px 3px rgba(184, 191, 201, 0.2), 0 0 0 3px rgba(26, 86, 219, 0.15);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-warning { background: #fff5e5; color: var(--warning); }
.badge-success { background: #e5f9e7; color: var(--success); }
.badge-danger { background: #ffe5e5; color: var(--danger); }
.badge-info { background: #e5f6ff; color: var(--info); }
.badge-agent {
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(126, 34, 206, 0.3);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 12px rgba(0,0,0,0.02);
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    background: #fbfbfd;
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid #e5e5ea;
}
.table td {
    padding: 16px;
    border-bottom: 1px solid #f2f2f7;
    font-size: 14px;
    vertical-align: middle;
}
.table tbody tr:hover {
    background: #fbfbfd;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.stat-blue { background: #e5f0ff; color: var(--primary); }
.stat-green { background: #e5f9e7; color: var(--success); }
.stat-orange { background: #fff5e5; color: var(--warning); }
.stat-purple { background: #f3e8ff; color: #9333ea; }

.stat-title {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -1px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        border-radius: 0 25px 25px 0;
        padding: 20px;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        padding: 15px;
        overflow-x: hidden;
    }
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .mobile-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background: #ffffff;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        margin: -15px -15px 20px -15px;
        width: calc(100% + 30px);
        position: sticky;
        top: 0;
        z-index: 900;
        border-radius: 0 0 24px 24px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    }
    .mobile-menu-btn {
        font-size: 28px;
        color: #000; /* changed from var(--primary) to black */
        cursor: pointer;
        background: none;
        border: none;
        padding: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .glass-card {
        padding: 15px;
    }
    .page-header h2 { font-size: 20px !important; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.active { display: block; }
}

.mobile-header { display: none; }

/* Modal System */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-container {
    background: var(--surface);
    border: 1px solid var(--border-color);
    box-shadow: 10px 10px 30px rgba(0,0,0,0.15), -10px -10px 30px rgba(255,255,255,0.8), var(--inner-highlight);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal-container {
    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-header h3 {
    margin: 0;
    font-size: 18px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--danger);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

