/**
 * Nexta CRM - Premium Glassmorphism CSS
 * Ultra-Modern SaaS Design
 */

/* ========== Variables ========== */
:root {
    /* NEXTA palette — gold / caramel / taupe / maroon */
    --bg-primary: #170504;
    --bg-secondary: #221009;
    --bg-tertiary: #2E1710;
    --glass-bg: rgba(255, 244, 230, 0.03);
    --glass-bg-hover: rgba(255, 244, 230, 0.06);
    --glass-border: rgba(255, 233, 214, 0.09);
    --glass-border-hover: rgba(255, 233, 214, 0.18);
    --text-primary: #FFF6EC;
    --text-secondary: rgba(255, 243, 229, 0.72);
    --text-muted: rgba(255, 240, 224, 0.42);
    --accent-primary: #D9B061;
    --accent-secondary: #8D6F57;
    --accent-tertiary: #C9A87C;
    --accent-gradient: linear-gradient(135deg, #D9B061, #8D6F57);
    --success: #4C956C;
    --warning: #D9B061;
    --danger: #C1443C;
    --info: #C9A87C;
    --border-color: rgba(255, 233, 214, 0.09);
    --shadow-sm: 0 2px 8px rgba(15, 3, 2, 0.25);
    --shadow-md: 0 8px 24px rgba(15, 3, 2, 0.35);
    --shadow-lg: 0 16px 48px rgba(15, 3, 2, 0.45);
    --shadow-glow: 0 0 40px rgba(217, 176, 97, 0.16);
    --card-bg: rgba(40, 18, 12, 0.6);
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

[data-theme="light"] {
    --bg-primary: #EFE7DC;
    --bg-secondary: #FBF7F1;
    --bg-tertiary: #E6DCCC;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-hover: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(63, 13, 12, 0.10);
    --glass-border-hover: rgba(63, 13, 12, 0.18);
    --text-primary: #3F0D0C;
    --text-secondary: rgba(63, 13, 12, 0.72);
    --text-muted: rgba(63, 13, 12, 0.45);
    --border-color: rgba(63, 13, 12, 0.10);
    --shadow-sm: 0 2px 8px rgba(63, 13, 12, 0.06);
    --shadow-md: 0 8px 24px rgba(63, 13, 12, 0.09);
    --shadow-lg: 0 16px 48px rgba(63, 13, 12, 0.12);
    --shadow-glow: 0 0 40px rgba(217, 176, 97, 0.18);
    --card-bg: rgba(255, 255, 255, 0.82);
}

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

html {
    scroll-behavior: smooth;
}

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

/* ========== Premium Glassmorphism ========== */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(217, 176, 97, 0.2);
}

.glass-modal {
    background: var(--card-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.3s ease;
}

.glass-panel:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
}

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

/* ========== Sidebar ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), transparent 50%);
    opacity: 0.3;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-img {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(217, 176, 97, 0.3);
}

.logo-icon {
    font-size: 32px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 8px rgba(217, 176, 97, 0.3));
}

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

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

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

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: 0 4px 4px 0;
    transition: height 0.3s ease;
}

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

.nav-link:hover::before {
    height: 24px;
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(217, 176, 97, 0.15), rgba(141, 111, 87, 0.1));
    color: white;
    box-shadow: 0 4px 16px rgba(217, 176, 97, 0.2);
}

.nav-link.active::before {
    height: 32px;
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 18px;
}

.nav-divider {
    padding: 20px 34px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
}

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

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(217, 176, 97, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
}

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

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

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ========== Top Header ========== */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(18, 18, 42, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    display: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--accent-primary);
    color: white;
}

.page-title h1 {
    font-size: 22px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-btn, .header-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
}

.theme-btn:hover, .header-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(217, 176, 97, 0.3);
}

/* ========== Page Content ========== */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ========== Premium Stats Cards ========== */
.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0.8;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(217, 176, 97, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(217, 176, 97, 0.15);
}

.stat-card.success::before { background: linear-gradient(90deg, #10b981, #059669); }
.stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stat-card.danger::before { background: linear-gradient(90deg, #ef4444, #dc2626); }
.stat-card.info::before { background: linear-gradient(90deg, #3b82f6, #2563eb); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(217, 176, 97, 0.3);
}

.stat-card.success .stat-icon { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3); }

.stat-value {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 6px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.stat-trend {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ========== Premium Tables ========== */
.table-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table {
    margin: 0;
    color: var(--text-primary);
}

.table thead th {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border-bottom: 1px solid var(--glass-border);
    padding: 18px 24px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.table tbody td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
    transition: background 0.3s ease;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: var(--glass-bg);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: transparent;
}

/* ========== Premium Buttons ========== */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(217, 176, 97, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(217, 176, 97, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

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

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

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

/* ========== Premium Forms ========== */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control, .form-select {
    width: 100%;
    padding: 14px 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(217, 176, 97, 0.15), 0 8px 24px rgba(217, 176, 97, 0.1);
    background: var(--glass-bg-hover);
}

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

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ========== Premium Auth Page ========== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #170504 0%, #1a1a3a 50%, #1A0705 100%);
}

[data-theme="light"] .bg-gradient {
    background: linear-gradient(135deg, #f0f2f8 0%, #e8ebf4 50%, #dde3ed 100%);
}

.bg-orbs {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(217, 176, 97, 0.3) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(141, 111, 87, 0.3) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(201, 168, 124, 0.2) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, 50px) scale(1.05); }
    50% { transform: translate(0, 100px) scale(1); }
    75% { transform: translate(-50px, 50px) scale(0.95); }
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 0 24px;
}

.auth-card {
    background: rgba(20, 20, 40, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 80px rgba(217, 176, 97, 0.1);
}

[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 0 80px rgba(217, 176, 97, 0.05);
}

.auth-logo {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo img {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(217, 176, 97, 0.3);
}

.auth-logo i {
    font-size: 56px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 8px 16px rgba(217, 176, 97, 0.3));
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 15px;
}

.auth-form .form-group {
    margin-bottom: 24px;
}

.auth-form .btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    margin-top: 8px;
}

.password-input {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--accent-primary);
}

/* ========== Premium Charts ========== */
.chart-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 28px;
}

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

.chart-title {
    font-size: 18px;
    font-weight: 700;
}

/* ========== Premium Badges ========== */
.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

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

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

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

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

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

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

/* ========== Premium Pagination ========== */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.page-link {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.page-link:hover, .page-link.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 176, 97, 0.3);
}

/* ========== Filter Bar ========== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    padding: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
}

.filter-bar .form-select, .filter-bar .form-control {
    width: auto;
    min-width: 160px;
}

/* ========== Premium Footer ========== */
.main-footer {
    padding: 24px 28px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    background: var(--glass-bg);
}

.footer-content {
    display: flex;
    justify-content: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== Sidebar Overlay ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* ========== Premium Toasts ========== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 320px;
    box-shadow: var(--shadow-lg);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }

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

/* ========== WhatsApp Button ========== */
.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
    color: white;
}

/* ========== Quick Actions ========== */
.quick-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-btn.edit:hover { background: var(--info); color: white; border-color: var(--info); }
.action-btn.delete:hover { background: var(--danger); color: white; border-color: var(--danger); }
.action-btn.view:hover { background: var(--success); color: white; border-color: var(--success); }

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state i {
    font-size: 72px;
    color: var(--text-muted);
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-secondary);
}

/* ========== Responsive ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 20px 16px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .glass-card {
        padding: 20px;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .form-select,
    .filter-bar .form-control {
        width: 100%;
    }
    
    .auth-card {
        padding: 32px 24px;
    }
    
    .table thead th, .table tbody td {
        padding: 14px 16px;
    }
}

/* ========== Animations ========== */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }

/* ========== Utilities ========== */
.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cursor-pointer {
    cursor: pointer;
}

/* Widget Cards */
.widget-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.3s ease;
}

.widget-card:hover {
    border-color: var(--glass-border-hover);
}

/* Dropdown */
.dropdown-menu {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.dropdown-header {
    padding: 10px 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.dropdown-divider {
    margin: 8px 0;
    border-color: var(--glass-border);
}

/* 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);
}

/* Loading */
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Nav Pills */
.nav-pills .nav-link {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    color: var(--text-secondary);
    margin: 0 4px;
    transition: all 0.3s ease;
}

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

.nav-pills .nav-link.active {
    background: var(--accent-gradient);
    color: white;
    border-color: var(--accent-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}
/* ============================================================
   PRO POLISH LAYER (v2.4) — fixes + professional refinements
   ============================================================ */

/* ---------- 1) TABLES: kill Bootstrap's white cells ---------- */
.table,
.table > :not(caption) > * > * {
    background-color: transparent !important;
    box-shadow: none !important;
    border-color: var(--glass-border) !important;
    color: var(--text-primary) !important;
}
.table { --bs-table-bg: transparent; --bs-table-color: var(--text-primary); --bs-table-border-color: var(--glass-border); }
.table thead th {
    background: linear-gradient(135deg, rgba(217,176,97,.10), rgba(141,111,87,.06)) !important;
    color: var(--accent-primary) !important;
    font-size: 11.5px;
    letter-spacing: 1.1px;
}
.table tbody td { color: var(--text-primary) !important; font-size: 13.5px; }
.table tbody td small, .table tbody td .small { color: var(--text-secondary) !important; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background: rgba(255, 244, 230, .02) !important; }
.table-hover > tbody > tr:hover > *,
.table tbody tr:hover > * { background: rgba(217, 176, 97, .06) !important; }
.table-responsive { background: transparent; }
.table .text-muted { color: var(--text-muted) !important; }
.table .fw-semibold, .table strong, .table b { color: var(--text-primary); }
.table .empty-state h3 { color: var(--text-primary) !important; }
.table .empty-state p { color: var(--text-secondary) !important; }
.table .empty-state i { color: var(--accent-primary); opacity: .9; font-size: 54px; }
[data-theme="light"] .table thead th { background: rgba(217, 176, 97, .12) !important; color: #7A5417 !important; }

/* ---------- 2) STAT CARDS: premium look ---------- */
.stat-card {
    background: linear-gradient(165deg, rgba(255, 244, 230, .055) 0%, rgba(255, 244, 230, .015) 100%);
}
.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(217, 176, 97, .38);
    box-shadow: 0 20px 44px rgba(10, 2, 1, .45), 0 0 0 1px rgba(217, 176, 97, .12);
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    background: linear-gradient(135deg, #D9B061, #8D6F57);
    color: #1A0705;
    box-shadow: 0 8px 22px rgba(217, 176, 97, .28);
}
.stat-value {
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
}
.stat-label { letter-spacing: .9px; }

/* ---------- 3) EMPTY STATES ---------- */
.empty-state i { color: var(--accent-primary); opacity: .85; }

/* ---------- 4) DROPDOWNS (bell / user menus) ---------- */
.dropdown-menu {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
}
.dropdown-item { color: var(--text-primary) !important; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; }
.dropdown-item:hover, .dropdown-item:focus { background: rgba(217, 176, 97, .10) !important; color: var(--accent-primary) !important; }
.dropdown-item.text-danger { color: var(--danger) !important; }
.dropdown-divider { border-color: var(--glass-border); }
.dropdown-header { color: var(--text-muted) !important; }

/* ---------- 5) ALERTS (backup / telegram results) ---------- */
.alert { border-radius: var(--radius-md); font-size: 13.5px; }
.alert-success { background: rgba(76, 149, 108, .12) !important; border: 1px solid rgba(76, 149, 108, .4) !important; color: #A9DCBC !important; }
.alert-danger  { background: rgba(193, 68, 60, .12) !important; border: 1px solid rgba(193, 68, 60, .4) !important; color: #F2B0AB !important; }
.alert-warning { background: rgba(217, 176, 97, .12) !important; border: 1px solid rgba(217, 176, 97, .4) !important; color: #EBD3A2 !important; }
.alert-info    { background: rgba(201, 168, 124, .12) !important; border: 1px solid rgba(201, 168, 124, .4) !important; color: #E3C88E !important; }

/* ---------- 6) FORM CONTROLS: unified dark/gold ---------- */
.form-control, .form-select {
    background-color: rgba(15, 5, 4, .45) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md);
    font-size: 14px;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-control:focus, .form-select:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(217, 176, 97, .18) !important;
    background-color: rgba(15, 5, 4, .55) !important;
    color: var(--text-primary) !important;
}
.form-select option { background: var(--bg-secondary); color: var(--text-primary); }
.form-label { color: var(--text-secondary); font-weight: 600; font-size: 12.5px; letter-spacing: .3px; }
.form-check-input { background-color: rgba(15,5,4,.45); border-color: var(--glass-border-hover); }
.form-check-input:checked { background-color: var(--accent-primary); border-color: var(--accent-primary); }
[data-theme="light"] .form-control, [data-theme="light"] .form-select { background-color: rgba(255,255,255,.85) !important; }

/* ---------- 7) BUTTONS ---------- */
.btn-primary {
    background: linear-gradient(135deg, #E3C88E, #D9B061 45%, #B58A43) !important;
    color: #2A1009 !important;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(217, 176, 97, .28);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(217, 176, 97, .38);
    color: #1A0705 !important;
}
.btn-primary i { color: inherit; }
.btn-secondary {
    background: rgba(255, 244, 230, .06) !important;
    border: 1px solid var(--glass-border-hover) !important;
    color: var(--text-primary) !important;
}
.btn-secondary:hover { background: rgba(255, 244, 230, .11) !important; }
.btn-success { background: linear-gradient(135deg, #58A97C, #4C956C) !important; color: #fff !important; }
.btn-danger  { background: linear-gradient(135deg, #D05A52, #C1443C) !important; color: #fff !important; }
.btn-warning { background: linear-gradient(135deg, #E3C88E, #D9B061) !important; color: #2A1009 !important; font-weight: 700; }

/* ---------- 8) BADGES ---------- */
.badge { font-weight: 600; letter-spacing: .2px; font-size: 11.5px; padding: 5px 10px; border-radius: 8px; }
.badge-active   { background: rgba(76, 149, 108, .16); color: #7EC29A; border: 1px solid rgba(76, 149, 108, .35); }
.badge-inactive { background: rgba(255, 244, 230, .07); color: var(--text-secondary); border: 1px solid var(--glass-border); }
.badge-warning  { background: rgba(217, 176, 97, .16); color: #E3C88E; border: 1px solid rgba(217, 176, 97, .38); }
.badge-danger   { background: rgba(193, 68, 60, .16); color: #F2A9A3; border: 1px solid rgba(193, 68, 60, .38); }
.bg-secondary { background: rgba(255,244,230,.10) !important; }

/* ---------- 9) PAGINATION ---------- */
.pagination .page-link {
    background: rgba(255, 244, 230, .05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 10px !important;
    margin: 0 3px;
    min-width: 38px; text-align: center;
    font-size: 13px;
}
.pagination .page-item.active .page-link,
.pagination .page-link:hover {
    background: linear-gradient(135deg, #D9B061, #8D6F57);
    border-color: transparent;
    color: #1A0705;
    font-weight: 700;
}
.pagination .page-item.disabled .page-link { opacity: .4; }

/* ---------- 10) SIDEBAR refinement ---------- */
.sidebar-nav .nav-link {
    border-radius: 12px;
    padding: 11px 14px;
    display: flex; align-items: center; gap: 13px;
    font-size: 14px; font-weight: 500;
    color: var(--text-secondary);
    transition: all .2s;
}
.sidebar-nav .nav-link .nav-icon { width: 20px; text-align: center; font-size: 15px; }
.sidebar-nav .nav-link:hover { background: rgba(217, 176, 97, .08); color: var(--text-primary); }
.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(217, 176, 97, .18), rgba(141, 111, 87, .12));
    border: 1px solid rgba(217, 176, 97, .30);
    color: var(--accent-primary) !important;
    box-shadow: inset 3px 0 0 var(--accent-primary);
}
.nav-divider span { letter-spacing: 1.6px; font-size: 10.5px; }

/* ---------- 11) TYPOGRAPHY / GLOBALS ---------- */
.page-content h2 { letter-spacing: -0.6px; font-weight: 800; }
.glass-card h5, .glass-card h6 { letter-spacing: -0.2px; }
::placeholder { color: var(--text-muted); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(217, 176, 97, .25); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(217, 176, 97, .45); }
.breadcrumb-item, .breadcrumb-item a { color: var(--text-muted); text-decoration: none; font-size: 13px; }
.breadcrumb-item.active { color: var(--accent-primary); }
.text-gradient {
    background: linear-gradient(135deg, #F2DCA6, #D9B061 60%, #B58A43);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="light"] .text-gradient {
    background: linear-gradient(135deg, #A8842C, #8D6F57);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- 12) MODALS ---------- */
.glass-modal, .modal-content {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-lg) !important;
    color: var(--text-primary) !important;
}
.modal-header, .modal-footer { border-color: var(--glass-border) !important; }
.btn-close { filter: invert(1) brightness(.8); }
[data-theme="light"] .btn-close { filter: none; }

/* ---------- 13) FILTER BAR polish ---------- */
.filter-bar { gap: 10px; }
.search-box { position: relative; }
.search-box .form-control { padding-left: 44px; }
.search-box > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }

/* ---------- 14) BOOTSTRAP UTILITY COLOR FIXES (dark theme legibility) ---------- */
.text-muted { color: var(--text-secondary) !important; }
.text-success { color: #7EC29A !important; }
.text-danger  { color: #F2A9A3 !important; }
.text-warning { color: #E3C88E !important; }
.text-info    { color: #E3C88E !important; }
.text-primary { color: var(--accent-primary) !important; }
.bg-success-subtle { background: rgba(76, 149, 108, .16) !important; }
.bg-danger-subtle  { background: rgba(193, 68, 60, .16) !important; }
.bg-warning-subtle { background: rgba(217, 176, 97, .16) !important; }
.bg-info-subtle    { background: rgba(201, 168, 124, .16) !important; }
[data-theme="light"] .text-muted { color: rgba(63, 13, 12, .62) !important; }
[data-theme="light"] .text-success { color: #2E7D4F !important; }
[data-theme="light"] .text-danger  { color: #B23830 !important; }
[data-theme="light"] .text-warning { color: #8A6414 !important; }
hr { border-color: var(--glass-border); opacity: 1; }

/* ---------- 15) HEADER ICON BUTTONS (gear / bell / user) ---------- */
.theme-btn, .header-btn {
    background: rgba(255, 244, 230, .06) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--accent-primary) !important;
    box-shadow: none !important;
    border-radius: 13px !important;
}
.theme-btn:hover, .header-btn:hover {
    background: rgba(217, 176, 97, .15) !important;
    border-color: rgba(217, 176, 97, .45) !important;
    color: #F2DCA6 !important;
    transform: translateY(-1px);
}
.header-btn.dropdown-toggle::after { display: none !important; }
.badge-dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: #D9B061; box-shadow: 0 0 0 2px var(--bg-secondary); }
.header-right .dropdown { position: relative; }

/* ============================================================
   MOBILE RESPONSIVE (v2.5)
   ============================================================ */
@media (max-width: 1199px) {
    .page-content { padding: 20px; }
}
@media (max-width: 991px) {
    .main-content { margin-left: 0 !important; }
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 1200; }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; opacity: 1; }
    .top-header { padding: 0 14px; }
    .page-title h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
    .header-right { gap: 8px; }
    .theme-btn, .header-btn { width: 38px; height: 38px; font-size: 15px; border-radius: 11px !important; }
}
@media (max-width: 767px) {
    .page-content { padding: 14px 12px 80px; }
    .page-content h2 { font-size: 20px; }
    .page-content .text-muted { font-size: 12.5px; }
    .glass-card { padding: 16px !important; border-radius: 16px !important; }
    .stat-card { padding: 16px !important; border-radius: 16px !important; }
    .stat-value { font-size: 20px !important; }
    .stat-icon { width: 38px; height: 38px; font-size: 15px; border-radius: 11px; }
    .filter-bar { flex-direction: column; align-items: stretch !important; }
    .filter-bar .form-control, .filter-bar .form-select, .filter-bar .btn { width: 100%; }
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 720px; }
    .table thead th, .table tbody td { padding: 12px 14px !important; }
    .btn { padding: 10px 16px; font-size: 13.5px; }
    .btn-sm { padding: 8px 12px; font-size: 12.5px; }
    .form-jumpnav { top: 64px; overflow-x: auto; flex-wrap: nowrap; padding: 8px 10px; }
    .jump-chip { white-space: nowrap; }
    .modal-dialog { margin: 10px; }
    .glass-modal, .modal-content { border-radius: 16px !important; }
    .row.g-4 { --bs-gutter-y: 1rem; }
    .nav-pills .nav-link { padding: 8px 12px; font-size: 13px; }
    .portal-card, .cp-card, .auth-card { padding: 26px 18px !important; margin: 0 8px; }
    .chart-title { font-size: 13.5px; }
    .d-flex.justify-content-between.mb-4 { flex-wrap: wrap; gap: 10px; }
    .header-right .dropdown-menu { right: -40px; }
    .breadcrumb { font-size: 12px; }
    .info-item span, .info-item label { font-size: 13px; }
    .avatar-lg { width: 64px !important; height: 64px !important; font-size: 24px !important; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 420px) {
    .page-title h1 { max-width: 38vw; }
    .stat-value { font-size: 17px !important; }
    .row > [class*="col-"] { padding-left: 6px; padding-right: 6px; }
}
/* Fallback modal/dropdown styles used when Bootstrap JS/CSS fail */
.modal.nx-open { display: block; }
.dropdown-menu.nx-open { display: block; }
.modal-backdrop.nx { display: block; }
