:root {
    --bg-main: #0a0a0f;
    --bg-sidebar: #111118;
    --bg-card: #16161f;
    --bg-hover: #1e1e2a;
    --text-primary: #f0f0f5;
    --text-secondary: #94a3b8;
    --border-color: #2a2a36;
    
    --accent-blue: #4f8ef7;
    --accent-purple: #7c3aed;
    --accent-gradient: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    
    --status-active: #10b981;
    --status-grace: #f59e0b;
    --status-suspended: #ef4444;
    --status-expired: #6b7280;
    
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 15px;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--accent-purple);
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar.collapsed {
    width: 70px;
}
.sidebar.collapsed .sidebar-brand, 
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .user-details {
    display: none;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: 24px;
    color: var(--accent-blue);
    margin-right: 10px;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 18px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-weight: 500;
}
.sidebar-nav li.active a, .sidebar-nav li a:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-right: 3px solid var(--accent-blue);
}
.sidebar-nav li a i {
    font-size: 20px;
    margin-right: 15px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}
.user-info {
    display: flex;
    align-items: center;
}
.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 10px;
}
.user-details {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}
.user-name { font-weight: 600; }
.user-role { color: var(--text-secondary); font-size: 11px; text-transform: uppercase; }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 60px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover { color: var(--text-primary); }

.content-area {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
}

/* Typography & Utilities */
h1, h2, h3, h4 { margin-bottom: 15px; font-weight: 600; }
.text-muted { color: var(--text-secondary); }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}
.card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(79, 142, 247, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.card-title { margin-bottom: 0; font-size: 16px; }

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(79, 142, 247, 0.1);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}
.stat-content h3 { font-size: 24px; margin-bottom: 5px; }
.stat-content p { color: var(--text-secondary); font-size: 13px; margin: 0; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    outline: none;
    font-size: 14px;
}
.btn-primary { background: var(--accent-gradient); color: white; border: none; }
.btn-primary:hover { opacity: 0.9; box-shadow: 0 0 10px rgba(124, 58, 237, 0.4); }
.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.btn-danger { background-color: var(--status-suspended); color: white; }
.btn-danger:hover { background-color: #dc2626; }
.btn-outline-danger { background: transparent; border-color: var(--status-suspended); color: var(--status-suspended); }
.btn-outline-danger:hover { background: var(--status-suspended); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Forms */
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; color: var(--text-secondary); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    background-color: #0f0f15;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 142, 247, 0.2);
}
.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 12px; top: 12px; color: var(--text-secondary); font-size: 18px; }
.input-with-icon input { padding-left: 40px; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th { font-weight: 600; color: var(--text-secondary); font-size: 13px; text-transform: uppercase; }
tr:hover td { background-color: rgba(255,255,255,0.02); }

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-active { background-color: rgba(16, 185, 129, 0.15); color: var(--status-active); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-grace { background-color: rgba(245, 158, 11, 0.15); color: var(--status-grace); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-suspended { background-color: rgba(239, 68, 68, 0.15); color: var(--status-suspended); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-expired { background-color: rgba(107, 114, 128, 0.15); color: var(--status-expired); border: 1px solid rgba(107, 114, 128, 0.3); }

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #111118 0%, #0a0a0f 100%);
}
.login-card {
    background: var(--bg-card);
    width: 400px;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header i { font-size: 48px; color: var(--accent-blue); margin-bottom: 10px; }
.login-header h2 { margin-bottom: 5px; }

/* Alerts */
.alert { padding: 12px 15px; border-radius: 6px; margin-bottom: 15px; font-size: 14px; }
.alert-danger { background-color: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background-color: rgba(16, 185, 129, 0.1); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.2); }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.tab-link {
    background: transparent;
    border: none;
    padding: 10px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}
.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    padding: 25px;
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-secondary); cursor: pointer; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-hover); transition: .4s; border-radius: 20px;
}
.slider:before {
    position: absolute; content: ""; height: 14px; width: 14px;
    left: 3px; bottom: 3px; background-color: var(--text-secondary); transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-blue); }
input:checked + .slider:before { transform: translateX(20px); background-color: white; }

/* Toasts */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--bg-card); border: 1px solid var(--border-color); border-left: 4px solid var(--accent-blue);
    padding: 12px 20px; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    color: var(--text-primary); min-width: 250px; animation: slideIn 0.3s ease-out;
}
.toast.toast-error { border-left-color: var(--status-suspended); }
.toast.toast-success { border-left-color: var(--status-active); }

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

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
