/* ============================================================
   AuraBlast CRM - Futuristic Cyber-Glassmorphism Stylesheet
   Ultra-modern Dark Theme with Neon Cyber Accents & Mobile-First
   ============================================================ */

:root {
    --bg-main: #07090e;
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-input: rgba(3, 7, 18, 0.7);
    --border-color: rgba(56, 189, 248, 0.18);
    --border-glow: rgba(56, 189, 248, 0.4);
    
    --neon-cyan: #38bdf8;
    --neon-cyan-glow: 0 0 15px rgba(56, 189, 248, 0.45);
    --neon-indigo: #818cf8;
    --neon-emerald: #10b981;
    --neon-rose: #f43f5e;
    --neon-amber: #f59e0b;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Subtle Sci-Fi Ambient Grid */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.04) 0%, transparent 40%),
                linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* App Wrapper Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #0284c7, #6366f1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    box-shadow: 0 0 15px rgba(2, 132, 199, 0.5);
}

.brand-text span {
    color: var(--neon-cyan);
}

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

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    padding: 10px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(56, 189, 248, 0.08);
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.1));
    border-left: 3px solid var(--neon-cyan);
    font-weight: 600;
    box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.1);
}

.nav-icon {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    stroke: currentColor;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(3, 7, 18, 0.5);
}

.user-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info {
    margin-left: 10px;
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    font-size: 10px;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: var(--header-height);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.mobile-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 16px;
    padding: 6px;
}

.page-title-wrap h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.system-status-indicator {
    display: flex;
    align-items: center;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--neon-emerald);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--neon-emerald);
    margin-right: 8px;
    box-shadow: 0 0 8px var(--neon-emerald);
    animation: pulse-glow 2s infinite;
}

.content-container {
    padding: 32px;
    flex: 1;
}

/* Cyber Cards */
.cyber-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.25s ease;
}

.cyber-card:hover {
    border-color: rgba(56, 189, 248, 0.35);
}

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.stat-card {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--accent-color, var(--neon-cyan));
    box-shadow: 0 0 10px var(--accent-color, var(--neon-cyan));
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.stat-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 15px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    box-shadow: 0 0 25px rgba(2, 132, 199, 0.6);
    transform: translateY(-1px);
}

.btn-cyber {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.btn-cyber:hover {
    background: rgba(56, 189, 248, 0.22);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    color: #ffffff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--neon-rose);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: var(--text-muted);
}

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

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

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

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 13.5px;
    transition: all 0.2s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
    background: rgba(15, 23, 42, 0.95);
}

.form-text {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
}

.cyber-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.cyber-table th {
    background: rgba(3, 7, 18, 0.6);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.cyber-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    color: var(--text-primary);
    font-size: 13.5px;
}

.cyber-table tr:hover td {
    background: rgba(56, 189, 248, 0.03);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger  { background: rgba(244, 63, 94, 0.15); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-info    { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-muted   { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Alerts & Toasts */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--neon-emerald); color: #a7f3d0; }
.alert-danger  { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--neon-rose); color: #fecaca; }
.alert-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--neon-amber); color: #fef08a; }

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-backdrop.show { display: flex; }

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 650px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

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

.modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(3, 7, 18, 0.4);
}

/* Quill Editor Dark Theme Overrides */
.ql-toolbar.ql-snow {
    background: rgba(3, 7, 18, 0.6) !important;
    border: 1px solid var(--border-color) !important;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.ql-toolbar.ql-snow .ql-stroke { stroke: #94a3b8 !important; }
.ql-toolbar.ql-snow .ql-fill { fill: #94a3b8 !important; }
.ql-toolbar.ql-snow .ql-picker { color: #94a3b8 !important; }
.ql-toolbar.ql-snow button:hover .ql-stroke { stroke: var(--neon-cyan) !important; }
.ql-container.ql-snow {
    background: rgba(3, 7, 18, 0.4) !important;
    border: 1px solid var(--border-color) !important;
    border-top: none !important;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    color: #f1f5f9 !important;
    font-size: 14px;
    min-height: 240px;
}

/* Mail Merge Variable Badges */
.tag-pill {
    display: inline-block;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-family: monospace;
    font-weight: 600;
    cursor: pointer;
    margin: 3px;
    transition: all 0.15s ease;
}
.tag-pill:hover {
    background: var(--neon-cyan);
    color: #07090e;
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.9); }
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .mobile-toggle-btn {
        display: block;
    }
    .content-container {
        padding: 20px 16px;
    }
    .app-topbar {
        padding: 0 16px;
    }
}

