/* Modern SaaS Aesthetics for Micro-Analytics */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-dark: #0b0f19;
    --bg-card: #131b2e;
    --bg-card-hover: #1c2742;
    --bg-input: #172138;
    --border-color: #233152;
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --heat-low: rgba(59, 130, 246, 0.6);
    --heat-mid: rgba(234, 179, 8, 0.8);
    --heat-high: rgba(239, 68, 68, 0.95);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-code: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* Header Navbar */
.navbar {
    background: rgba(19, 27, 46, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--accent-glow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Page Layout */
.main-content {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;

}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Authentication Layout */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.1), transparent 40%);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    box-shadow: var(--shadow-main);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-input, .form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: #3b4d75;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

/* Cards & Stats Grid */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
}

.stat-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
    color: #fff;
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}

/* Content Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Embed Script Box */
.embed-box {
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    position: relative;
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: #a5b4fc;
    overflow-x: auto;
    word-break: break-all;
    margin-top: 0.75rem;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;

}

.badge-info {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-device {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Alerts */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Heatmap Viewer Overlay Container */
.heatmap-viewport-container {
    background: #090d16;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 1.5rem;
    overflow: auto;
    position: relative;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

.heatmap-canvas-wrapper {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

#heatmapCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    pointer-events: none;
}

.dot-marker {
    position: absolute;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -7px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(239,68,68,1) 0%, rgba(239,68,68,0.4) 60%, rgba(239,68,68,0) 100%);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
    pointer-events: none;
    z-index: 20;
    animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
}

.footer {
    text-align: center;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: auto;
}
