/* ═══════════════════════════════════════════════════════
   LandingFactory V2 — Admin Panel Stylesheet
   ═══════════════════════════════════════════════════════ */

:root {
    --bg-deep: #0a0e1a;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --sidebar-bg: #020617;
    --sidebar-w: 220px;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: rgba(59, 130, 246, 0.12);
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #1e293b;
    --border-light: #334155;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── ANIMATIONS ───────────────────────────────────────── */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ─── SIDEBAR ──────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 500;
    padding: 24px 20px;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}

.sidebar-header strong {
    color: var(--text-main);
}

.nav-links {
    list-style: none;
    flex: 1;
    padding: 16px 12px;
}

.nav-links li {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-links li:hover {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.nav-links li.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-version {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ─── MAIN CONTENT ─────────────────────────────────────── */

.content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 32px 40px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* ─── CARDS ────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 28px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.card-header h2 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

/* ─── SITES GRID ───────────────────────────────────────── */

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    animation: slideUp 0.3s ease;
}

.site-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.08);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.card-actions {
    margin-top: 20px;
    display: flex;
    gap: 8px;
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px;
    color: var(--text-muted);
}

/* ─── BUTTONS ──────────────────────────────────────────── */

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-ghost:hover {
    color: var(--text-main);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.9rem;
}

.gen-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* ─── TERMINAL ─────────────────────────────────────────── */

.terminal-box {
    background: #000000;
    color: #4ade80;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    padding: 20px;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #1a1a1a;
}

.terminal-prompt {
    color: var(--primary);
}

/* ─── MODAL ────────────────────────────────────────────── */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-dark);
    width: 90%;
    max-width: 560px;
    margin: 40px auto;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    animation: slideUp 0.3s ease;
}

.modal-wide {
    max-width: 720px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 28px 0;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
    display: block;
}

.close-modal,
.close-new-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.close-modal:hover,
.close-new-modal:hover {
    color: var(--text-main);
    background: var(--bg-card);
}

/* ─── MODAL TABS ───────────────────────────────────────── */

.modal-tabs {
    display: flex;
    gap: 0;
    padding: 18px 28px 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.modal-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.modal-tab:hover {
    color: var(--text-secondary);
}

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modal-tab-content {
    display: none;
    padding: 24px 28px;
}

.modal-tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* ─── FORMS ────────────────────────────────────────────── */

.form-section {
    margin-bottom: 28px;
}

.form-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: flex;
    gap: 14px;
}

.form-row.two-col>.form-group {
    flex: 1;
}

.form-row.three-col>.form-group {
    flex: 1;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.upload-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.upload-input-group input {
    flex: 1;
}

.btn-upload {
    padding: 8px 12px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.badge-accent {
    font-size: 0.65rem;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ─── COLOR INPUTS ─────────────────────────────────────── */

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-text {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
}

/* ─── CHECKBOXES ───────────────────────────────────────── */

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ─── SERVICES TOGGLES ─────────────────────────────────── */

.services-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.service-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: var(--transition);
}

.service-item.active {
    border-color: var(--green);
}

.service-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.service-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-item-info span {
    font-size: 0.85rem;
    font-weight: 500;
}

.service-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-light);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    bottom: 3px;
    left: 3px;
    transition: var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--green);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

/* ─── INFO BOX ─────────────────────────────────────────── */

.info-box {
    display: flex;
    gap: 12px;
    background: var(--primary-soft);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 12px;
}

.info-box i {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box strong {
    font-size: 0.85rem;
    display: block;
    margin-bottom: 4px;
}

.info-box p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.info-box code {
    background: var(--bg-card);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ─── MODAL FOOTER ─────────────────────────────────────── */

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px 24px;
    border-top: 1px solid var(--border);
}

.modal-footer-left,
.modal-footer-right {
    display: flex;
    gap: 8px;
}

/* ─── TOAST NOTIFICATIONS ──────────────────────────────── */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
    min-width: 280px;
}

.toast.success {
    border-left: 3px solid var(--green);
}

.toast.error {
    border-left: 3px solid var(--red);
}

.toast.info {
    border-left: 3px solid var(--primary);
}

/* ─── RESPONSIVE ───────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 12px;
    }

    .sidebar-header span,
    .nav-links li span,
    .sidebar-version {
        display: none;
    }

    .content {
        margin-left: 60px;
        padding: 20px;
    }

    .modal-content {
        width: 96%;
        margin: 16px auto;
    }

    .form-row {
        flex-direction: column;
    }

    .modal-tabs {
        gap: 0;
    }

    .modal-tab span {
        display: none;
    }
}

/* ─── PREVIEW MODAL ────────────────────────────────────── */

.modal-fullscreen {
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.preview-frame-wrapper {
    flex: 1;
    background: #1a1a2e;
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    padding: 0;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    transition: width 0.3s ease, max-width 0.3s ease;
}

.preview-iframe.mobile {
    max-width: 390px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    margin: 16px auto;
    height: calc(100% - 32px);
}

.close-preview-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition);
}

.close-preview-modal:hover {
    color: var(--text-main);
}

/* ─── FORM SELECT ──────────────────────────────────────── */

.form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    appearance: auto;
    transition: var(--transition);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-select-sm {
    width: auto;
    padding: 6px 10px;
    font-size: 0.8rem;
}

/* ─── TEXTAREA ─────────────────────────────────────────── */

.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ─── BADGES (for copy editor) ─────────────────────────── */

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.form-hint-inline {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ─── BENEFIT EDITOR CARD ──────────────────────────────── */

.benefit-edit-card {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
}

.benefit-edit-card .benefit-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.benefit-edit-card .benefit-header i {
    width: 16px;
    height: 16px;
}

/* ─── REVIEW EDITOR CARD ──────────────────────────────── */

.review-edit-card {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 16px;
}

.review-edit-card .review-edit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.review-edit-card .review-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, #06B6D4 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.review-edit-card .review-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ─── BTN ACTIVE STATE ─────────────────────────────────── */

.btn-ghost.active,
.btn-ghost.active:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   ANALYTICS DASHBOARD
   ═══════════════════════════════════════════════════════ */

/* ─── KPI CARDS ────────────────────────────────────────── */

.analytics-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    animation: slideUp 0.4s ease;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #06B6D4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.1);
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon i {
    width: 22px;
    height: 22px;
}

.kpi-views {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.kpi-clicks {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.kpi-conversion {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
}

.kpi-alert {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.kpi-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text-main), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-badge {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.kpi-trend {
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.kpi-trend-up {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.kpi-trend-down {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* ─── ANALYTICS LAYOUT ─────────────────────────────────── */

.analytics-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

.analytics-panel .card,
.analytics-detail .card {
    min-height: 400px;
}

/* ─── ANALYTICS TABLE ──────────────────────────────────── */

.analytics-table-wrapper {
    margin-top: 16px;
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.analytics-table thead th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.analytics-table tbody tr {
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    transition: background 0.15s ease;
    cursor: pointer;
}

.analytics-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.analytics-table tbody tr.selected {
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
}

.analytics-table td {
    padding: 12px 14px;
    vertical-align: middle;
}

.analytics-table .site-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.analytics-table .site-cell .site-name {
    font-weight: 600;
    color: var(--text-main);
}

.analytics-table .site-cell .site-city {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.analytics-table .value-cell {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.analytics-table .conv-cell {
    font-weight: 700;
    color: #a855f7;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 500;
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active::before {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.status-dot.no-data::before {
    background: var(--text-muted);
}

.analytics-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ─── DETAIL PANEL ─────────────────────────────────────── */

.analytics-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
}

.analytics-detail-empty p {
    font-size: 0.85rem;
}

.detail-mini-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.mini-kpi {
    background: var(--bg-deep);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.mini-kpi-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.mini-kpi-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
    font-weight: 500;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ─── BAR CHART (CSS-only) ─────────────────────────────── */

.bar-chart-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    width: 80px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-deep);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary), #06B6D4);
    display: flex;
    align-items: center;
    padding-left: 8px;
    min-width: 0;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-value {
    font-size: 0.68rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.bar-value-outside {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 8px;
    flex-shrink: 0;
}

/* ─── CLICKS BREAKDOWN ─────────────────────────────────── */

.clicks-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.click-type-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.click-type-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.click-type-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.click-type-icon i {
    width: 16px;
    height: 16px;
}

.click-type-icon.whatsapp {
    background: rgba(37, 211, 102, 0.15);
    color: #25D366;
}

.click-type-icon.call {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.click-type-icon.other {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.click-type-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.click-type-count {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

/* ─── SUSPICIOUS IPS ───────────────────────────────────── */

.suspicious-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.suspicious-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
}

.suspicious-ip {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.suspicious-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ─── EVENTS FEED ──────────────────────────────────────── */

.events-feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.events-feed::-webkit-scrollbar {
    width: 4px;
}

.events-feed::-webkit-scrollbar-track {
    background: transparent;
}

.events-feed::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-deep);
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    transition: var(--transition);
}

.event-item:hover {
    border-color: var(--border-light);
}

.event-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.event-badge.view {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.event-badge.click {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.event-badge.suspicious {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.event-page {
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-time {
    color: var(--text-muted);
    font-size: 0.68rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.event-ip {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    flex-shrink: 0;
}

/* ─── NO-DATA STATE ────────────────────────────────────── */

.no-data-message {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 20px;
    opacity: 0.7;
}

/* ─── ANALYTICS RESPONSIVE ─────────────────────────────── */

@media (max-width: 1200px) {
    .analytics-layout {
        grid-template-columns: 1fr;
    }

    .analytics-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-kpis {
        grid-template-columns: 1fr;
    }

    .detail-mini-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}