/* ============================================================
   CronBeacon — Styles custom (App + Landing)
   ============================================================ */

/* --- Variables CSS --- */
:root {
    --cb-brand: #0052CC;
    --cb-brand-dark: #003D99;
    --cb-brand-light: #E6F0FF;
    --cb-success: #198754;
    --cb-warning: #F59E0B;
    --cb-danger: #DC3545;
    --cb-text: #0F172A;
    --cb-text-secondary: #64748B;
    --cb-text-muted: #94A3B8;
    --cb-surface: #F8FAFC;
    --cb-border: #E2E8F0;
}

/* --- Base body --- */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--cb-text);
    background: var(--cb-surface);
    line-height: 1.6;
}

/* ============================================================
   App layout
   ============================================================ */

/* App Navbar */
.cb-app-navbar {
    background: #fff;
    border-bottom: 1px solid var(--cb-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cb-app-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--cb-text);
    letter-spacing: -0.5px;
}
.cb-app-navbar .navbar-brand i { color: var(--cb-warning); }
.cb-app-navbar .nav-link {
    color: var(--cb-text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 14px !important;
    border-radius: 6px;
    transition: all 0.15s;
}
.cb-app-navbar .nav-link:hover,
.cb-app-navbar .nav-link.active {
    color: var(--cb-brand);
    background: var(--cb-brand-light);
}
.cb-app-navbar .nav-link i { margin-right: 4px; }

/* Cards (app) */
.cb-card {
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    transition: all 0.2s;
}
.cb-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* Status badges */
.badge-on_time, .badge-on-time { background: var(--cb-success) !important; }
.badge-late { background: var(--cb-warning) !important; color: #000 !important; }
.badge-degraded { background: var(--cb-warning) !important; color: #000 !important; }
.badge-missed { background: var(--cb-danger) !important; }
.badge-failing { background: var(--cb-danger) !important; }
.badge-unknown { background: var(--cb-text-muted) !important; }

/* Counter cards */
.cb-counter {
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    transition: all 0.2s;
}
.cb-counter:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.cb-counter h2 { font-size: 2rem; font-weight: 700; margin: 0; }
.cb-counter small { color: var(--cb-text-muted); font-weight: 500; }

.cb-counter.border-success { border-left: 4px solid var(--cb-success) !important; }
.cb-counter.border-warning { border-left: 4px solid var(--cb-warning) !important; }
.cb-counter.border-danger { border-left: 4px solid var(--cb-danger) !important; }

/* Tables */
.cb-table { border-radius: 12px; overflow: hidden; }
.cb-table .table { margin-bottom: 0; }
.cb-table .table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cb-text-secondary);
    border-bottom: 2px solid var(--cb-border);
}
.cb-table .table td { vertical-align: middle; }
.cb-table .table tbody tr { transition: background 0.15s; }
.cb-table .table tbody tr:hover { background: var(--cb-brand-light); }

/* Buttons (app — compact) */
.btn-cb-primary {
    background: var(--cb-brand);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-cb-primary:hover {
    background: var(--cb-brand-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,82,204,0.3);
}

/* Page header */
.cb-page-header h4 {
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--cb-text);
}
.cb-page-header p { color: var(--cb-text-muted); }

/* Alert banner */
.cb-alert-banner {
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    border-radius: 10px;
    padding: 14px 20px;
    color: var(--cb-danger);
}
.cb-alert-banner a { color: var(--cb-danger); font-weight: 600; }

/* Quick link cards */
.cb-quick-link {
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
    color: var(--cb-text);
}
.cb-quick-link:hover {
    border-color: var(--cb-brand);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,82,204,0.1);
    color: var(--cb-brand);
}
.cb-quick-link i { font-size: 1.5rem; color: var(--cb-brand); }

/* Language switcher */
.cb-lang-switch .btn {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}
.cb-lang-switch .btn.active {
    background: var(--cb-brand-light);
    color: var(--cb-brand);
    border-color: var(--cb-brand);
}

/* Filters */
.cb-filters {
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    padding: 12px 16px;
}

/* ============================================================
   Landing page
   ============================================================ */

/* Landing Navbar */
.cb-navbar {
    background: #fff;
    border-bottom: 1px solid var(--cb-border);
    padding: 16px 0;
}
.cb-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--cb-text);
    letter-spacing: -0.5px;
}
.cb-navbar .navbar-brand i { color: var(--cb-warning); }
.cb-navbar .nav-link {
    color: var(--cb-text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}
.cb-navbar .nav-link:hover { color: var(--cb-brand); }

/* Hero */
.cb-hero {
    padding: 100px 0 80px;
    background: linear-gradient(180deg, #fff 0%, var(--cb-surface) 100%);
}
.cb-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -1px;
    color: var(--cb-text);
}
.cb-hero .lead {
    font-size: 1.2rem;
    color: var(--cb-text-secondary);
    max-width: 560px;
}

/* Buttons (landing — larger) */
.btn-cb-outline {
    background: transparent;
    color: var(--cb-brand);
    border: 2px solid var(--cb-brand);
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-cb-outline:hover {
    background: var(--cb-brand-light);
    color: var(--cb-brand-dark);
}

/* Sections */
.cb-section {
    padding: 80px 0;
}
.cb-section-alt {
    background: var(--cb-surface);
}
.cb-section h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}
.cb-section .section-lead {
    font-size: 1.1rem;
    color: var(--cb-text-secondary);
    max-width: 600px;
}

/* Trust strip */
.cb-trust {
    padding: 40px 0;
    border-bottom: 1px solid var(--cb-border);
}
.cb-trust-item {
    color: var(--cb-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}
.cb-trust-item i {
    color: var(--cb-success);
    margin-right: 6px;
}

/* Steps */
.cb-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cb-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Code block */
.cb-code {
    background: #1E293B;
    color: #E2E8F0;
    border-radius: 12px;
    padding: 24px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    overflow-x: auto;
}
.cb-code .comment { color: #64748B; }
.cb-code .string { color: #86EFAC; }
.cb-code .flag { color: #93C5FD; }

/* Pricing */
.cb-pricing-card {
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: 16px;
    padding: 40px 32px;
    position: relative;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.cb-pricing-card > ul:last-of-type {
    margin-bottom: auto !important;
}
.cb-pricing-card > a:last-child {
    margin-top: auto;
}
.cb-pricing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.cb-pricing-card.popular {
    border: 2px solid var(--cb-brand);
    box-shadow: 0 8px 24px rgba(0,82,204,0.12);
}
.cb-pricing-card .price {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
}
.cb-pricing-card .price-period {
    color: var(--cb-text-muted);
    font-size: 0.95rem;
}

/* FAQ */
.cb-faq .accordion-button {
    font-weight: 600;
    color: var(--cb-text);
    font-size: 1.05rem;
}
.cb-faq .accordion-button:not(.collapsed) {
    background: var(--cb-brand-light);
    color: var(--cb-brand-dark);
}
.cb-faq .accordion-body {
    color: var(--cb-text-secondary);
    line-height: 1.7;
}

/* Use cases tags */
.cb-tag {
    display: inline-block;
    background: var(--cb-brand-light);
    color: var(--cb-brand);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 4px;
}

/* Footer */
.cb-footer {
    background: var(--cb-text);
    color: var(--cb-text-muted);
    padding: 60px 0 40px;
}
.cb-footer a { color: var(--cb-text-muted); text-decoration: none; }
.cb-footer a:hover { color: #fff; }
.cb-footer h6 { color: #fff; font-weight: 600; margin-bottom: 16px; }

/* Final CTA */
.cb-final-cta {
    background: var(--cb-brand);
    color: #fff;
    padding: 80px 0;
}
.cb-final-cta h2 { color: #fff; }
.cb-final-cta p { color: rgba(255,255,255,0.8); }

/* Feature grid icons */
.icon-green { background: #D1FAE5; color: var(--cb-success); }
.icon-blue { background: var(--cb-brand-light); color: var(--cb-brand); }
.icon-amber { background: #FEF3C7; color: #D97706; }
.icon-red { background: #FEE2E2; color: var(--cb-danger); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .cb-counter h2 { font-size: 1.5rem; }
    .cb-hero h1 { font-size: 2rem; }
    .cb-hero { padding: 60px 0 40px; }
    .cb-section { padding: 60px 0; }
    .cb-pricing-card { margin-bottom: 16px; }
}

/* ============================================================
   Turbo progress bar
   ============================================================ */
.turbo-progress-bar {
    height: 3px;
    background: linear-gradient(90deg, var(--cb-brand) 0%, #4D94FF 100%);
}

/* ============================================================
   Page transitions
   ============================================================ */
@keyframes cb-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cb-page-enter {
    animation: cb-fade-in 0.22s ease-out;
}

/* ============================================================
   Loading state (Stimulus loading controller)
   ============================================================ */
.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.18s ease;
    position: relative;
}
.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.45);
    border-radius: inherit;
    z-index: 5;
}

/* ============================================================
   Toast notifications
   ============================================================ */
#cb-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    min-width: 300px;
    max-width: 380px;
}
.cb-toast {
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.cb-toast .toast-progress {
    height: 3px;
    width: 100%;
    background: rgba(255,255,255,0.5);
    border-radius: 0 0 10px 10px;
    transition: none;
}

/* ============================================================
   Empty states
   ============================================================ */
.cb-empty-state {
    padding: 3.5rem 2rem;
    text-align: center;
    color: var(--cb-text-secondary);
}
.cb-empty-state .cb-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.55;
}
.cb-empty-state p {
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

/* ============================================================
   LiveComponent smooth update
   ============================================================ */
[data-live-component-root] {
    transition: opacity 0.15s ease;
}
[data-live-component-root][data-live-updating] {
    opacity: 0.7;
}
