:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-main: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.glass-panel-modal {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Layout */
.dashboard-container {
    display: flex;
    width: 100%;
    height: 100vh;
    padding: 16px;
    gap: 20px;
}

/* Sidebar */
.sidebar {
    width: 280px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-links li:not(.submenu li) {
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-links li:not(.submenu li):hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.nav-links li.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Dropdown */
.submenu {
    list-style: none;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    margin-left: 24px;
    margin-top: -4px;
    margin-bottom: 4px;
    border-left: 1px solid var(--glass-border);
}
.submenu.open {
    max-height: 400px;
}

.submenu li {
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.95rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}
.submenu li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--glass-border);
}

.submenu li:hover, .submenu li.active {
    color: var(--text-main);
}

.dropdown-icon {
    transition: transform 0.3s ease;
}
.dropdown-toggle.open .dropdown-icon {
    transform: rotate(180deg);
}

.sidebar-badge {
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: hidden; /* We manage overflow inside sections */
}

/* Header */
.top-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.2);
    padding: 10px 20px;
    border-radius: 20px;
    width: 350px;
    border: 1px solid var(--glass-border);
}

.search-bar i {
    color: var(--text-muted);
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
    font-size: 0.95rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Views */
.view-section {
    display: none;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow: hidden;
}
.view-section.active {
    display: flex;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    flex-shrink: 0;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    flex-shrink: 0;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

/* Service color swatch */
.service-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid var(--glass-border);
    display: inline-block;
    vertical-align: middle;
}

.service-icon-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.2rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
}



.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

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

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.05);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Table */
.table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 20px;
}

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

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    background: var(--bg-main);
    z-index: 10;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Expiration Warning Row */
tr.expiring-soon {
    background: var(--danger-bg);
}
tr.expiring-soon:hover {
    background: rgba(239, 68, 68, 0.25);
}
tr.expiring-soon td {
    color: #fca5a5;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge.safe {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}
.badge.danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.badge.warning {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Actions in Table */
.action-btns {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}
.btn-icon.delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
}
.btn-icon.mail:hover {
    background: var(--primary);
    color: white;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 30px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header i {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}
.modal-header i:hover {
    color: var(--danger);
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.row {
    flex-direction: row;
    gap: 16px;
}

.form-group .col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

input, select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
    transition: border 0.3s ease;
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--primary);
}

select option {
    background: var(--bg-main);
    color: var(--text-main);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
    gap: 16px;
}
.empty-state i {
    font-size: 4rem;
    opacity: 0.5;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}
.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--danger);
    border-left: 5px solid var(--danger);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    animation: slideOut 0.3s ease forwards;
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Notification Dropdown & Bell */
.bell-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    pointer-events: none;
    border: 2px solid var(--bg-main);
}
.bell-badge.pulse {
    animation: pulse 1s infinite alternate;
}

.notif-dropdown {
    position: absolute;
    top: 40px;
    right: -10px;
    width: 360px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9999;
}
.notif-dropdown.show {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}
.notif-header {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notif-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}
.notif-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.notif-item {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.notif-item:hover {
    background: rgba(255,255,255,0.05);
}
.notif-item.unread {
    background: rgba(99, 102, 241, 0.1);
    position: relative;
}
.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 24px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}
.notif-item .notif-title {
    font-weight: 600;
    color: var(--text-main);
    padding-left: 12px;
}
.notif-item .notif-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 12px;
}
.notif-item .notif-time {
    font-size: 0.75rem;
    color: var(--primary);
    padding-left: 12px;
}
.notif-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* Table font adjustment */
#customerTable td { font-size: 0.88rem; }
#customerTable th { font-size: 0.8rem; }


/* Responsive */
@media (max-width: 1200px) {
    .dashboard-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 16px;
        gap: 8px;
    }
    .logo { margin-bottom: 0; }
    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }
    .nav-links li:not(.submenu li) {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .submenu {
        margin-left: 0;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .main-content {
        overflow-y: auto;
    }
    .table-container {
        overflow-x: auto;
    }
    table {
        table-layout: auto;
        min-width: 900px;
    }
    .page-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .top-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        min-height: auto;
    }
    .search-bar {
        width: 100%;
    }
    .actions-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .modal-content {
        max-width: 95vw;
        padding: 20px;
    }
    .form-group.row {
        flex-direction: column;
    }
}

/* Custom Scrollbar */
.table-container::-webkit-scrollbar {
    height: 6px;
}
.table-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}
.table-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

