/* RevShare Pro - Styles */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 0.625rem;
    --radius-lg: 1rem;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.3);
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Auth Page - Modern Executive Design */
.auth-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}

.auth-page .site-footer {
    margin-top: auto;
    width: 100%;
    z-index: 10;
}

.auth-decor {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 1;
    opacity: 0.15;
    animation: float 20s infinite alternate;
}

.auth-decor-1 {
    top: -100px;
    right: -100px;
    background: var(--primary);
}

.auth-decor-2 {
    bottom: -150px;
    left: -150px;
    background: #6366f1;
    animation-delay: -5s;
}

@keyframes float {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(50px, 50px) scale(1.1);
    }
}

.auth-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 20px 40px -10px rgba(0, 0, 0, 0.12),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    padding: 3rem 2.5rem;
    animation: authIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

@keyframes authIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 1rem;
        align-items: center;
        /* Ensure vertical centering */
    }

    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
        width: 100%;
        margin: 0;
        /* Remove any default margins */
    }
}

.auth-logo-brand .logo-icon {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    border-radius: 14px;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.auth-logo-brand .logo-text {
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

/* Forms */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* Forms - Refined for Auth Icons */
.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: #ffffff;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-form .form-input {
    background: #fcfcfd;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: white;
    transform: translateY(-1px);
}

.form-input:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    border-color: var(--border-light);
}


/* Buttons - Standardized Design System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
    /* Touch-friendly minimum */
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: var(--warning);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    min-height: 52px;
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Mobile button enhancements */
@media (max-width: 640px) {
    .btn {
        min-height: 48px;
        font-size: 0.9375rem;
    }

    .btn-lg {
        min-height: 52px;
    }
}

/* Layout & Sidebar Base */
.app-layout {
    display: flex;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    /* Premium Dark Navy */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: 80px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.sidebar-logo img {
    max-height: 38px;
    width: auto;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    white-space: nowrap;
}

.logo-text .accent {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.75rem;
    overflow-y: auto;
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: #94a3b8;
    /* Slate 400 */
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: white;
}

.sidebar .nav-item.active {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.sidebar .nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.sidebar .nav-item.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-avatar.vector-avatar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.user-profile-link {
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 12px;
}

.user-profile-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem 2.5rem;
    background: var(--bg-primary);
    min-width: 0;
    overflow-y: auto;
}

#global-announcements-container:empty {
    display: none;
}

/* Mobile Header & Responsive */
.mobile-header {
    display: none;
    position: fixed;
    /* Changed from sticky to fixed for better mobile reliability */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    /* Higher than sidebar */
    height: 64px;
    padding: 0 1.25rem;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    font-size: 1.75rem;
    color: white;
    cursor: pointer;
    margin-right: -10px;
    z-index: 1201;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 2000;
        /* Sidebar should be on top of everything */
    }

    .sidebar.open,
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 15px 0 35px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
        padding-top: 84px;
        /* Space for fixed mobile header */
    }

    .mobile-header {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 1500;
        /* Between content and sidebar */
    }

    .sidebar-overlay.open,
    .sidebar-overlay.active {
        display: block;
    }
}

/* Responsive Forms & Security Section */
.security-info-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    margin-bottom: 2rem;
    width: 100%;
}

.user-email-text {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
    word-break: break-all;
    overflow-wrap: break-word;
}

.password-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: flex-end;
}

@media (max-width: 640px) {
    .security-info-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
    }

    /* Stack the icon and text vertically too */
    .security-info-box>div:first-child {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .security-info-box .badge {
        align-self: center;
    }

    .user-email-text {
        font-size: 0.75rem;
        /* Smaller on mobile */
        max-width: 100%;
    }

    .password-form-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .password-form-grid button {
        width: 100% !important;
        margin-top: 0.5rem;
        min-height: 50px;
        padding: 0 !important;
    }
}

/* Site Config Responsiveness */
.site-config-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.ad-units-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .site-config-box {
        flex-direction: column;
        padding: 1.5rem;
        text-align: center;
    }

    .site-config-box input {
        text-align: center;
        width: 100%;
    }

    .ad-units-flex {
        justify-content: center;
    }

    .form-label {
        text-align: center;
    }
}

.ad-unit-badge {
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.05);
    /* Gray transparency */
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    font-size: 0.8125rem;
    transition: all 0.2s ease;
}

.ad-unit-badge:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Gradient Cards */
.stat-card.gradient-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2), 0 2px 4px -1px rgba(79, 70, 229, 0.1);
}

.stat-card.gradient-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.2), 0 2px 4px -1px rgba(5, 150, 105, 0.1);
}

.stat-card.gradient-warning {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.2), 0 2px 4px -1px rgba(217, 119, 6, 0.1);
}

.stat-card.gradient-info {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(8, 145, 178, 0.2), 0 2px 4px -1px rgba(8, 145, 178, 0.1);
}

.stat-card[class*="gradient-"] .stat-card-title,
.stat-card[class*="gradient-"] .stat-card-value,
.stat-card[class*="gradient-"] .stat-card-subtitle {
    color: white;
}

.stat-card[class*="gradient-"] .stat-card-title {
    opacity: 0.9;
}

.stat-card[class*="gradient-"] .stat-card-subtitle {
    opacity: 0.8;
}

/* Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .grid-4,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Publisher Dashboard Stats Grid */
#dash-stats {
    width: 100%;
}

#dash-stats .grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
}

@media (max-width: 1024px) {
    #dash-stats .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    #dash-stats .grid-4 {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        padding: 84px 1rem 1.25rem 1rem;
    }
}

.page-header button {
    width: 100%;
    min-height: 48px;
    /* Touch target size */
    justify-content: center;
    margin-top: 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    font-size: 0.9375rem;
}

/* Daily Share Packs button stacking */
.share-pack-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
}

.share-pack-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 48px !important;
}

/* Payout Balance Card - centered and full width on mobile */
.payout-balance-card {
    width: 100%;
    margin: 0 auto;
    text-align: center;
}
}

/* Responsive Utilities */
.flex-stack-mobile {
    display: flex;
}

@media (max-width: 768px) {
    .flex-stack-mobile {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
}

@media (max-width: 1024px) {
    .grid-stack-tablet {
        grid-template-columns: 1fr !important;
    }
}

.instruction-box {
    background: #f0f7ff;
    border: 1px solid #cce3ff;
    padding: 12px 16px;
    border-radius: 12px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius);
    position: relative;
}

/* Subtle scroll indicator for mobile */
.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}

.table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: #fcfcfd;
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.table td {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.table tbody tr:nth-child(even) {
    background: var(--bg-tertiary);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--primary-glow) !important;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-default {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-pending {
    background: #fffbeb;
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #92400e;
    padding: 1.25rem;
    border-radius: 14px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--warning);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 2000;
    /* Increased to stay above mobile header (1200) */
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-light);
}

.modal-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fcfcfd;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 1.75rem;
}

.modal-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #fcfcfd;
}

/* Form Layout Helpers */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter Bar & Responsive Actions */
.filter-card {
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-light);
    background: #f8fafc;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-group {
    display: flex;
    background: white;
    border: 1px solid var(--border-light);
    padding: 4px;
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.date-range-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid var(--border-light);
    padding: 6px 14px;
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 1rem;
    }

    .filter-group,
    .btn-group,
    .date-range-container {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .btn-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 0.75rem;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .btn-group .btn {
        width: 100%;
        justify-content: center;
        margin: 0 !important;
        border-radius: 10px !important;
        padding: 0.875rem 1rem !important;
        background: white !important;
        border: 1px solid var(--border) !important;
        color: var(--text-secondary) !important;
        font-weight: 600 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }

    .btn-group .btn:active,
    .btn-group .btn.active {
        background: var(--primary-light) !important;
        border-color: var(--primary) !important;
        color: var(--primary) !important;
    }


    .date-range-container {
        padding: 16px;
        gap: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .date-input-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .date-input-group label {
        font-size: 0.6875rem;
        font-weight: 800;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-left: 4px;
    }

    .date-range-container input[type="date"] {
        width: 100% !important;
        background: white;
        padding: 12px;
        border-radius: 10px;
        border: 1px solid #cbd5e1;
        /* Clearer, slightly darker border */
        font-size: 0.9375rem;
        color: var(--text-primary);
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .filter-group form {
        flex-direction: column;
        width: 100%;
    }

    .filter-group form button {
        width: 100%;
        margin-top: 8px;
    }

    .mobile-hide {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }
}

.mobile-only {
    display: none;
}

/* Utilities */
.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-secondary);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Admin Sidebar */
.sidebar-admin {
    background: linear-gradient(180deg, #1e3a5f 0%, #1e293b 100%);
}

.sidebar-admin .sidebar-header {
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-admin .sidebar-logo {
    color: white;
}

.sidebar-admin .nav-item {
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-admin .nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-admin .nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Code Snippet Style */
.code-snippet {
    background: #1e293b;
    border-radius: var(--radius);
    padding: 1rem;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-snippet code {
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.code-snippet .snippet-label {
    position: absolute;
    top: 0;
    right: 1rem;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.site-footer {
    margin-top: auto;
    padding: 2rem 2.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.02);
    width: 100%;
    z-index: 10;
}

.footer-branding {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 600;
}

.footer-link:hover {
    color: var(--primary);
}

.auth-page .site-footer {
    position: relative;
    z-index: 10;
    margin-top: auto;
    border-top: none;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

@media (max-width: 640px) {
    .site-footer {
        flex-direction: column;
        gap: 1.25rem;
        text-align: center;
        padding: 2rem 1.5rem;
    }

    .footer-links {
        justify-content: center;
    }

    .modal-footer {
        flex-direction: column-reverse;
        /* Put primary action on top/bottom depending on preference, usually primary top is better but column-reverse puts first item (cancel) at bottom */
        gap: 0.75rem;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
        height: 48px;
    }
}



/* Modal Close Button */
.btn-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close:hover {
    background: var(--bg-tertiary);
    color: var(--danger);
}

/* Searchable Select Component */
.search-select-container {
    position: relative;
    width: 100%;
}

.search-select-input {
    padding-right: 40px !important;
}

.search-select-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 5px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 2100;
    box-shadow: var(--shadow-lg);
    display: none;
}

.search-results.active {
    display: block;
}

.search-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-light);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: var(--primary-light);
}

.search-item .name {
    display: block;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.search-item .email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Audit Log Badge Styles */
.badge-green {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
    font-weight: 700 !important;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #2563eb !important;
    font-weight: 700 !important;
}

.badge-red {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #dc2626 !important;
    font-weight: 700 !important;
}

.badge-indigo {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #4f46e5 !important;
    font-weight: 700 !important;
}

.badge-gray {
    background: rgba(107, 114, 128, 0.1) !important;
    color: #6b7280 !important;
    font-weight: 700 !important;
}

.hover-row:hover {
    background: rgba(79, 70, 229, 0.02);
    transition: background 0.2s ease;
}

/* ============ Chat System Styles ============ */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.chat-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.chat-button .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid var(--border-light);
}

.chat-window.open {
    display: flex;
}

.chat-window-header {
    background: var(--primary);
    color: white;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-window-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

/* Chat Header Button Hover */
.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Minimized State */
.chat-window.minimized {
    height: auto !important;
}

.chat-window.minimized .chat-messages,
.chat-window.minimized .chat-input-area {
    display: none !important;
}

.chat-window.minimized .chat-window-header {
    cursor: pointer;
}


/* Shared Chat Components */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    word-break: break-word;
    /* Handle long words/URLs */
}

.chat-message {
    width: fit-content;
    max-width: 85%;
    min-width: 80px;
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    position: relative;
    white-space: pre-wrap;
    /* Support new lines */
    overflow-wrap: anywhere;
    /* Handle extremely long URLs */
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.received {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid var(--border-light);
}

.chat-message-time {
    display: block;
    font-size: 10px;
    margin-top: 5px;
    opacity: 0.6;
}

.chat-message.sent .chat-message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.9);
}

.chat-message.received .chat-message-time {
    color: var(--text-muted);
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.75rem;
    background: white;
}

.chat-input-area input,
.chat-input-area textarea {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    resize: none;
}

.chat-input-area textarea {
    min-height: 44px;
    max-height: 250px;
    padding-top: 10px;
    overflow-y: hidden;
    /* Hide scrollbar until needed */
}

.chat-input-area textarea.has-scroll {
    overflow-y: auto;
}

.chat-input-area input:focus,
.chat-input-area textarea:focus {
    border-color: var(--primary);
}

/* Admin Chat Layout */


.main-content.no-scroll {
    overflow: hidden !important;
    padding-bottom: 0;
    gap: 0 !important;
}

.main-content.no-scroll #app-content-wrapper {
    height: 100%;
}

/* Chat Inbox Layout - Optimized for Viewport */
.chat-inbox-layout {
    display: grid;
    grid-template-columns: 320px 1fr 280px;
    flex: 1;
    min-height: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--border-light);
    border-bottom: none;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.no-scroll .chat-inbox-layout {
    margin-bottom: 0;
    border-radius: 20px 20px 0 0;
}

.chat-session-list {
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    background: #fbfbfc;
    min-height: 0;
}

.chat-session-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: white;
}

#sessions-container {
    flex: 1;
    overflow-y: auto;
}

.chat-session-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.chat-session-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.chat-session-item.active {
    background: white;
    box-shadow: inset 4px 0 0 var(--primary);
}

.session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    min-width: 0;
}

.publisher-name {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.last-msg {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Chat Main View */
.chat-view {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border-right: 1px solid var(--border-light);
    min-height: 0;
}

.chat-view-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* Using shared .chat-messages style */

.chat-input-area {
    padding: 1.25rem;
    background: white;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.chat-input-area input,
.chat-input-area textarea {
    flex: 1;
    border: 1.5px solid var(--border-light);
    border-radius: 14px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
    background: #fcfcfd;
    font-family: inherit;
    resize: none;
}

.chat-input-area textarea {
    min-height: 52px;
    max-height: 250px;
    overflow-y: hidden;
}

.chat-input-area textarea.has-scroll {
    overflow-y: auto;
}

.chat-input-area input:focus,
.chat-input-area textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Chat Sidebar Details */
.chat-publisher-details {
    display: flex;
    flex-direction: column;
    background: white;
    min-height: 0;
}

.chat-details-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.chat-publisher-details h5 {
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.chat-detail-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f8fafc;
}

.chat-detail-item:last-child {
    border-bottom: none;
}

.chat-detail-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-detail-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chat-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.chat-blocked-overlay {
    position: absolute;
    top: 60px;
    /* Below header */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
}

.chat-blocked-overlay svg {
    display: block;
    margin: 0 auto;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
}

.received .message-meta {
    justify-content: flex-start;
}

.chat-message-time {
    font-size: 10px;
}

.chat-message-seen {
    color: #fff;
    /* White for read on primary background */
    display: flex;
    align-items: center;
}

.chat-message-sent {
    color: rgba(255, 255, 255, 0.7);
    /* Transparent white for sent */
    display: flex;
    align-items: center;
}

/* Using shared .chat-message styles from above */

/* Typing Indicator */
.typing-indicator-bubble {
    display: inline-block;
    padding: 10px 16px;
    background: #e2e8f0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    margin-bottom: 10px;
    width: fit-content;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Unread Divider */
.unread-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    position: relative;
    width: 100%;
}

.unread-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--danger);
    opacity: 0.2;
    z-index: 1;
}

.unread-divider span {
    background: var(--danger-light);
    color: var(--danger);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 1200px) {
    .chat-inbox-layout {
        grid-template-columns: 280px 1fr;
    }

    .chat-publisher-details {
        display: none;
    }
}

@media (max-width: 768px) {
    .chat-inbox-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 120px);
    }

    /* DEFAULT STATE: Show List, Hide Chat */
    .chat-session-list {
        display: flex;
        width: 100%;
    }

    .chat-view {
        display: none;
        width: 100%;
    }

    /* ACTIVE STATE: Hide List, Show Chat */
    .chat-session-list.mobile-hidden {
        display: none;
    }

    .chat-view.mobile-active {
        display: flex;
    }

    /* Back Button in Chat Header */
    .chat-back-btn {
        display: flex !important;
        margin-right: 10px;
        padding: 8px;
        background: transparent;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
    }

    /* Mobile Sidebar Overlay */
    .chat-publisher-details {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2000;
        background: white;
        flex-direction: column;
    }

    .chat-publisher-details.mobile-visible {
        display: flex;
    }

    /* Close button for mobile sidebar */
    /* Mobile Sidebar Header */
    .mobile-sidebar-header {
        flex-shrink: 0;
        z-index: 2002;
    }

    .chat-details-content {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 20px;
        /* Space for bottom scroll */
    }

    /* Fix Input Area squashing */
    .chat-input-area {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .chat-input-area button {
        flex-shrink: 0;
        width: 44px !important;
        height: 44px !important;
    }

    .chat-input-area textarea {
        padding: 0.6rem 1rem;
        max-height: 120px;
    }

    /* Compact Header */
    .chat-view-header {
        padding: 0.75rem 1rem;
        min-height: 60px;
    }

    /* Wider Messages on Mobile */
    .chat-message {
        max-width: 88%;
        font-size: 0.9rem;
    }

    /* Header toggles */
    .chat-header-actions {
        display: flex;
        gap: 8px;
    }

    .btn-mobile-icon {
        padding: 8px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    .mobile-hidden {
        display: none !important;
    }

    .mobile-visible-only {
        display: flex !important;
    }

    /* Publisher Chat Widget Mobile */
    .chat-window {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        z-index: 10000;
        /* Above everything */
        flex-direction: column;
        margin: 0 !important;
    }

    .chat-window.open {
        display: flex !important;
    }

    /* Fix Minimized State on Mobile */
    .chat-window.minimized {
        height: auto !important;
        top: auto !important;
        bottom: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(0);
    }

    .chat-window-header {
        border-radius: 0 !important;
        padding-top: max(1.25rem, env(safe-area-inset-top));
        /* Handle notch */
        padding-bottom: 1rem;
    }

    /* Revenue Performance & Admin Dashboard Mobile */
    .grid.grid-3 {
        display: flex !important;
        flex-direction: column;
        gap: 1.5rem !important;
    }

    .grid.grid-3>* {
        width: 100% !important;
        grid-column: auto !important;
    }

    /* Adjust Chart Card height on mobile */
    .grid.grid-3 .card[style*="min-height: 350px"] {
        min-height: auto !important;
        padding: 1rem !important;
    }

    #revenuePerformanceChart {
        height: 220px !important;
    }

    /* Optimize Quick Stats sizing */
    .grid.grid-3 .flex.flex-col .card {
        padding: 1.25rem !important;
    }

    /* Hide launcher when chat is open to prevent clutter */
    /* Since we can't easily select sibling based on open state without :has, 
       we'll just use z-index to cover it with the white background of the chat window */
}

.chat-back-btn,
.mobile-sidebar-close,
.mobile-visible-only {
    display: none;
}

/* Home Landing Page - Modern Executive Design */
.landing-page {
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

.landing-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 5%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.landing-navbar.scrolled {
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.hero-section {
    padding: 180px 5% 120px;
    background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.08), transparent 400px),
        radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.05), transparent 400px);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* --- Professional Hero Header Improvements --- */
.hero-badge {
    position: relative;
    overflow: hidden;
    background: rgba(79, 70, 229, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(79, 70, 229, 0.2);
    padding: 0.6rem 1.25rem;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.hero-badge::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: skewX(-25deg);
    animation: badgeShimmer 4s infinite;
}

@keyframes badgeShimmer {
    0% {
        left: -100%;
    }

    30% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

.hero-title {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.04em;
    color: #0f172a;
    margin-bottom: 1.5rem;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 1px rgba(79, 70, 229, 0.1));
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.6;
    animation: fadeInUp 1s ease;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    animation: fadeInUp 1.2s ease;
}

/* Feature Grid */
.landing-section {
    padding: 100px 5%;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 5rem;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2.5rem;
    background: white;
    border-radius: 24px;
    border: 1px solid var(--border-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Dashboard Mockup Preview */
.hero-preview {
    margin-top: 5rem;
    position: relative;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    perspective: 2000px;
    animation: fadeInUp 1.4s ease;
}

.mockup-container {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 12px;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.15), 0 18px 36px -18px rgba(0, 0, 0, 0.1);
    transform: rotateX(5deg) translateY(0);
    transition: transform 0.5s ease;
}

.mockup-container:hover {
    transform: rotateX(0deg) translateY(-10px);
}

.mockup-img {
    width: 100%;
    height: auto;
    border-radius: 16px;
    display: block;
    background: #f1f5f9;
    /* Fallback placeholder */
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .hero-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .landing-navbar {
        padding: 0 1.5rem;
    }
}

/* --- Advanced Stats Section --- */
.stats-section {
    padding: 80px 5%;
    background: #0f172a;
    color: white;
    position: relative;
    overflow: hidden;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.05em;
}

.stat-label {
    font-size: 1rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* --- Professional Table for Payout Proofs --- */
.proofs-table-container {
    background: white;
    border-radius: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin-top: 2rem;
}

.proofs-table {
    width: 100%;
    border-collapse: collapse;
}

.proofs-table th {
    background: #f8fafc;
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.proofs-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f1f5f9;
}

.proof-status {
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
}

.proof-status-paid {
    background: #dcfce7;
    color: #15803d;
}

/* --- Advanced Dashboard Mockup --- */
.hero-viz {
    perspective: 2500px;
}

.dashboard-stack {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    transform-style: preserve-3d;
    transform: rotateY(-15deg) rotateX(10deg);
}

.viz-layer-1 {
    background: white;
    border-radius: 20px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.25);
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.viz-layer-2 {
    position: absolute;
    top: -40px;
    right: -60px;
    width: 320px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    z-index: 2;
    transform: translateZ(50px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.viz-layer-3 {
    position: absolute;
    bottom: -30px;
    left: -40px;
    width: 250px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: white;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 15px 35px rgba(124, 58, 237, 0.3);
    z-index: 3;
    transform: translateZ(100px);
}

/* Background blob decorations */
.blob-decor {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(60px);
}

.blob-1 {
    top: -200px;
    right: -100px;
}

.blob-2 {
    bottom: -300px;
    left: -200px;
}

/* Smooth Section Anchoring */
html {
    scroll-behavior: smooth;
}

[id] {
    scroll-margin-top: 100px;
}

/* --- Modern SaaS Illustration Styles --- */
/* --- Team Illustration Animations --- */
.team-illustration-container {
    width: 100%;
    max-width: 900px;
    height: auto;
    position: relative;
    margin: 0 auto;
}

.gear-rotate {
    animation: gearRotate 12s infinite linear;
    transform-origin: center;
}

@keyframes gearRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.plane-float {
    animation: planeFloat 4s ease-in-out infinite;
}

@keyframes planeFloat {

    0%,
    100% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(-10px) translateX(10px);
    }
}

.character-breathe {
    animation: characterBreathe 3s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes characterBreathe {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.02);
    }
}

.chart-data-animate {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: revealData 2s ease-out forwards;
}

@keyframes revealData {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-viz {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
}

.mesh-gradient-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    background:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.1) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(79, 70, 229, 0.1) 0, transparent 50%),
        radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.15) 0, transparent 50%);
    filter: blur(80px);
    z-index: -1;
    animation: meshRotate 20s infinite linear;
}

@keyframes meshRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.illustrative-stack {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    position: absolute;
    transition: all 0.5s ease;
}

.main-dashboard-viz {
    width: 500px;
    height: 350px;
    z-index: 10;
    transform: rotateX(10deg) rotateY(-10deg);
    animation: floatMain 6s ease-in-out infinite;
}

.floating-card-1 {
    width: 240px;
    top: -20px;
    right: 20px;
    z-index: 20;
    transform: translateZ(50px) rotateY(-5deg);
    animation: floatCard1 5s ease-in-out infinite;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
}

.floating-card-2 {
    width: 210px;
    bottom: 20px;
    left: 40px;
    z-index: 15;
    transform: translateZ(80px) rotateY(10deg);
    animation: floatCard2 7s ease-in-out infinite;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: white;
    border: none;
}

.revenue-line {
    position: absolute;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 3s ease-forward infinite;
    filter: drop-shadow(0 0 8px var(--primary));
}

@keyframes floatMain {

    0%,
    100% {
        transform: rotateX(10deg) rotateY(-10deg) translateY(0);
    }

    50% {
        transform: rotateX(8deg) rotateY(-8deg) translateY(-20px);
    }
}

@keyframes floatCard1 {

    0%,
    100% {
        transform: translateZ(50px) rotateY(-5deg) translateY(0);
    }

    50% {
        transform: translateZ(60px) rotateY(-3deg) translateY(-15px);
    }
}

@keyframes floatCard2 {

    0%,
    100% {
        transform: translateZ(80px) rotateY(10deg) translateY(0);
    }

    50% {
        transform: translateZ(100px) rotateY(12deg) translateY(10px);
    }
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@media (max-width: 768px) {
    .illustrative-stack {
        height: 400px;
        transform: scale(0.8);
    }

    .main-dashboard-viz {
        width: 100%;
        max-width: 400px;
        height: 280px;
    }

    .floating-card-1 {
        width: 180px;
        right: -10px;
        top: -30px;
    }

    .floating-card-2 {
        width: 160px;
        left: -10px;
        bottom: -10px;
    }
}

/* --- Mobile Responsiveness Utilities --- */
.mobile-only {
    display: none !important;
}

.mobile-menu-overlay {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .landing-navbar {
        padding: 0 1.5rem !important;
    }

    .landing-section {
        padding: 60px 1.5rem !important;
    }

    .hero-section {
        padding: 140px 1.5rem 80px !important;
    }

    .hero-title {
        font-size: 2.25rem !important;
        line-height: 1.2 !important;
    }

    .logo-text {
        font-size: 1.125rem !important;
    }

    .logo-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }

    .hero-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-actions .btn {
        width: 100%;
    }

    /* Mobile Menu Overlay Styles */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateY(-20px);
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .mobile-menu-content {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        width: 100%;
        padding: 2rem;
    }

    .mobile-menu-link {
        color: white;
        text-decoration: none;
        font-size: 1.5rem;
        font-weight: 700;
        transition: opacity 0.2s;
    }

    /* Responsive Payout Proofs Table */
    .proofs-table-container {
        border-radius: 16px;
        margin-top: 1rem;
    }

    .proofs-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .proofs-table th,
    .proofs-table td {
        padding: 1rem;
        min-width: 130px;
    }

    /* Hero Viz Adjustment */
    .dashboard-stack {
        transform: rotateY(0) rotateX(0) scale(0.8);
        margin-top: 2rem;
    }

    .viz-layer-2 {
        right: -10px !important;
        width: 170px !important;
    }

    .viz-layer-3 {
        left: -10px !important;
        width: 160px !important;
    }

    /* Stats Section */
    .stats-grid {
        gap: 2rem;
    }

    .stat-value {
        font-size: 2.5rem;
    }
}