/* WebScraper Premium Alpine Design System v5 - "Contrast & Clarity" Edition */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    /* "Premium Darkened Windows" Palette */
    --bg-main: #0a0f1d;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-modal: #0f172a;

    --primary: #3b82f6;
    /* Brighter Blue for contrast */
    --primary-dark: #2563eb;
    --accent: #1e293b;

    --text-main: #f1f5f9;
    /* Light grey for text on dark */
    --text-muted: #94a3b8;

    --border-light: rgba(255, 255, 255, 0.1);
    --border-rich: rgba(255, 255, 255, 0.2);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.8);

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(15, 23, 42, 0.9);
}

.glass-input {
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    width: 100%;
    transition: all 0.3s ease;
}

.glass-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: #0f172a;
}

.glass-input.lighter {
    background: rgba(255, 255, 255, 0.03);
}

i {
    color: inherit;
}

.sidebar i {
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.text-muted-light {
    color: var(--text-muted);
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(30, 41, 59, 0.2) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: #0a0f1d;
    /* Deeper dark */
    color: white;
    padding: 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-light);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.user-greeting {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.main-content {
    flex: 1;
    padding: 2.5rem;
    margin-left: 280px;
    width: calc(100% - 280px);
    transition: all 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
    width: 100%;
}

/* Utils */
.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-5 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.w-100 {
    width: 100%;
}

.d-none {
    display: none !important;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.row>* {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

.col-md-3 {
    flex: 0 0 auto;
    width: 25%;
}

.col-md-4 {
    flex: 0 0 auto;
    width: 33.333333%;
}

.col-md-6 {
    flex: 0 0 auto;
    width: 50%;
}

.col-md-8 {
    flex: 0 0 auto;
    width: 66.666667%;
}

.col-md-12 {
    flex: 0 0 auto;
    width: 100%;
}

.g-4 {
    --gutter-x: 1.5rem;
    --gutter-y: 1.5rem;
}

.row.g-4 {
    margin-top: calc(-1 * var(--gutter-y));
    margin-right: calc(-0.5 * var(--gutter-x));
    margin-left: calc(-0.5 * var(--gutter-x));
}

.row.g-4>* {
    margin-top: var(--gutter-y);
}

@media (max-width: 768px) {

    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-8 {
        width: 100%;
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

header h2 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sidebar Elements */
.sidebar .brand {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.sidebar .brand:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar .brand img {
    height: 44px;
    width: auto;
    transition: transform 0.3s ease;
}

.sidebar .brand:hover img {
    transform: scale(1.05);
}

.sidebar .nav-menu {
    list-style: none;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar .nav-link.active {
    background: var(--primary);
}

/* Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-xl);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white !important;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    border-color: var(--border-rich);
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle dark glass */
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    padding: 1.75rem;
    border-radius: 1.25rem;
    text-align: left;
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Tables - VISIBILITY FIX */
.table-container {
    background: var(--bg-card);
    border-radius: 1.25rem;
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--bg-main);
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
}

.table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Forms */
.form-control,
.glass-input,
select.glass-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-rich);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.9);
    /* Slightly more opaque for readability */
    color: var(--text-main);
    font-size: 0.95rem;
    appearance: none;
    -webkit-appearance: none;
}

select.glass-input,
select.form-control {
    background-color: #0f172a !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    color: #f1f5f9 !important;
}

select.glass-input option,
select.form-control option {
    background-color: #1e293b !important;
    /* Solid Slate 800 */
    color: #f1f5f9 !important;
    /* Light Slate 100 */
}


.glass-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}


.form-control:focus,
.glass-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    background: rgba(30, 41, 59, 0.8) !important;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* AI Status Widget in Sidebar */
.ai-status-widget {
    margin-top: 2rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

.ai-status-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.dot-offline {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

/* Dashboard Card Specifics */
.dashboard-card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-main);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Mobile Toggles */
.mobile-nav-toggle {
    display: none;
}

/* --- Email Modal Premium Overlays --- */
.email-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    /* Slate 900 semi-transparent */
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.email-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.email-modal {
    background: var(--bg-modal);
    width: 100%;
    max-width: 600px;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-rich);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.email-modal-overlay.active .email-modal {
    transform: translateY(0);
}

.email-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main);
}

.email-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.email-modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.email-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.email-recipient {
    padding: 1rem 1.5rem;
    background: rgba(59, 130, 246, 0.05);
    /* Very subtle primary tint */
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
}



.email-form-group {
    padding: 1.25rem 1.5rem 0.75rem;
}

.email-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.email-form-group input,
.email-form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-rich);
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.email-form-group input:focus,
.email-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.email-form-group textarea {
    min-height: 200px;
    resize: vertical;
}

.email-modal-actions {
    padding: 1.5rem;
    background: var(--bg-main);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-light);
}

.btn-cancel {
    background: white;
    border: 1px solid var(--border-rich);
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-send {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-send:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Mobile Nav Header (Floating) */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    z-index: 900;
}

.mobile-header span {
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

.mobile-nav-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: all 0.2s ease;
}

.mobile-nav-toggle:active {
    transform: scale(0.95);
}

#mobileNavOpen {
    display: flex;
}

#mobileNavClose {
    display: flex;
    margin-left: auto;
}

/* Sidebar Brand Redesign */
.sidebar .brand img {
    height: 32px;
    width: auto;
}

/* Mobile Lead Slider */
.lead-slider {
    display: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    padding-bottom: 1rem;
}

.lead-card {
    min-width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    scroll-snap-align: start;
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .main-content {
        padding: 6rem 1.25rem 2rem 1.25rem;
        margin-left: 0;
        width: 100%;
    }

    .sidebar {
        z-index: 2000;
    }

    .mobile-header {
        display: flex;
    }

    .table-container {
        display: none;
        /* Hide complex tables on small mobile */
    }

    .lead-slider {
        display: flex;
        /* Show card slider instead */
    }

    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-8 {
        width: 100%;
    }
}