/* ===== GLOBAL STYLES ===== */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-darker: #1e3a8a;
    --secondary: #64748b;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary, .btn-icon, .btn-logout {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--shadow);
}

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

.btn-secondary:hover {
    background: var(--surface-light);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    font-size: 1.25rem;
}

.btn-logout {
    background: var(--error);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ===== NAVIGATION ===== */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* ===== HERO SECTION ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-darker), var(--primary-dark));
    padding: 4rem 2rem;
    min-height: 100vh;
}

.hero-content {
    max-width: 1200px;
    margin: 4rem auto;
    text-align: center;
}

.hero-title {
    font-size: 4rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 4rem;
}

.hero-stats {
    display: flex;
    gap: 4rem;
    justify-content: center;
    margin-top: 4rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ===== FEATURES SECTION ===== */
.features {
    padding: 6rem 2rem;
    background: var(--background);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
    font-size: 2.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.feature-card p {
    color: var(--text-muted);
}

/* ===== METRICS SHOWCASE ===== */
.metrics-showcase {
    padding: 6rem 2rem;
    background: var(--surface);
}

.metrics-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.metric-item {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    font-size: 1.125rem;
}

/* ===== PRICING ===== */
.pricing {
    padding: 6rem 2rem;
    background: var(--background);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--surface);
    padding: 3rem 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    position: relative;
}

.pricing-card-featured {
    border-color: var(--primary);
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.3);
}

.pricing-badge {
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.pricing-tier {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.pricing-price {
    margin-bottom: 2rem;
}

.price-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
}

.price-period {
    color: var(--text-muted);
}

.pricing-features {
    list-style: none;
    margin-bottom: 2rem;
}

.pricing-features li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

/* ===== CTA ===== */
.cta {
    padding: 6rem 2rem;
    background: linear-gradient(135deg, var(--primary-darker), var(--primary-dark));
    text-align: center;
}

.cta h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.cta p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--surface);
    padding: 3rem 2rem;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto 2rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

/* ===== DASHBOARD ===== */
.dashboard-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--surface-light);
    color: var(--text);
}

.nav-item.active {
    background: var(--surface-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-icon {
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.workspace-selector {
    margin-bottom: 1rem;
}

.workspace-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
}

/* ===== DASHBOARD MAIN ===== */
.dashboard-main {
    flex: 1;
    overflow-y: auto;
    background: var(--background);
}

.dashboard-header {
    background: var(--surface);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-title {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.last-updated {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-email {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== DASHBOARD SECTION ===== */
.dashboard-section {
    padding: 2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.metric-icon {
    font-size: 1.5rem;
}

.metric-title {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.metric-change {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.metric-change.positive {
    color: var(--success);
}

.metric-change.negative {
    color: var(--error);
}

/* ===== CHARTS ===== */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-size: 1.25rem;
}

.time-range-select, .filter-select {
    padding: 0.5rem 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
}

canvas {
    max-height: 300px;
}

/* ===== SETUP PAGE ===== */
.setup-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.setup-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    max-width: 600px;
    width: 100%;
    position: relative;
}

.setup-header {
    text-align: center;
    margin-bottom: 2rem;
}

.setup-header .logo {
    font-size: 3rem;
}

.setup-header h1 {
    font-size: 2rem;
    margin: 1rem 0 0.5rem;
}

.setup-header p {
    color: var(--text-muted);
}

/* ===== STEPS ===== */
.steps-indicator {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
}

.step.active {
    opacity: 1;
}

.step-number {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--background);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.step.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== FORMS ===== */
.setup-form, .settings-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input, .search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 1rem;
}

.form-input:focus, .search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== KEYBOARD NAVIGATION & ACCESSIBILITY ===== */
/* Focus visible styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Interactive elements focus states */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-icon:focus-visible,
.btn-logout:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.nav-item:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -2px;
    background: rgba(59, 130, 246, 0.1);
}

.metric-card:focus-visible,
.feature-card:focus-visible,
.chart-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}

.workspace-select:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

.form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-divider {
    text-align: center;
    margin: 2rem 0;
    color: var(--text-muted);
    position: relative;
}

.form-divider::before,
.form-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.form-divider::before {
    left: 0;
}

.form-divider::after {
    right: 0;
}

.info-box {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.info-box code {
    background: var(--surface);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    color: var(--primary);
}

.info-box ol {
    margin-left: 1.5rem;
    margin-top: 1rem;
}

.info-box li {
    margin-bottom: 0.5rem;
}

/* ===== SUCCESS MESSAGE ===== */
.success-message {
    text-align: center;
}

.success-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.setup-summary {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    color: var(--text-muted);
}

.summary-value {
    font-weight: 600;
}

/* ===== LOADING & ERRORS ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 1rem;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: var(--error);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.setup-footer {
    margin-top: 2rem;
}

.setup-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.setup-footer a:hover {
    color: var(--primary);
}

/* ===== SESSIONS & AGENTS ===== */
.session-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.sessions-list, .agents-list, .alerts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cost-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cost-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.cost-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero-stats {
        flex-direction: column;
        gap: 2rem;
    }

    .nav-links {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .session-filters {
        flex-direction: column;
    }
}

/* ===== HAMBURGER MENU (BUG-57) ===== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-btn[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.hamburger-btn[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .nav .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 1rem 2rem;
        border-top: 1px solid var(--border);
        gap: 1rem;
        z-index: 200;
    }

    .nav .nav-links.nav-open {
        display: flex;
    }

    .nav {
        position: relative;
    }
}
