/* ── Base ─────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

/* ── AppBar ──────────────────────────────────────────────────────── */
.ha-appbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5) !important;
    transition: box-shadow 0.3s ease;
}

.nav-btn {
    text-transform: none !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    letter-spacing: 0 !important;
    font-size: 0.875rem !important;
    padding: 6px 18px !important;
    color: #475569 !important;
    border: 1px solid transparent !important;
    transition: all 0.2s ease !important;
}

.nav-btn:hover {
    color: #0f172a !important;
    background: rgba(6, 182, 212, 0.06) !important;
    border-color: rgba(6, 182, 212, 0.15) !important;
}

.nav-desktop {
    display: flex !important;
}

@media (max-width: 960px) {
    .nav-desktop {
        display: none !important;
    }
}

/* ── Language toggle ─────────────────────────────────────────────── */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #475569;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    user-select: none;
}

.lang-toggle:hover {
    color: #0f172a;
    background: rgba(6, 182, 212, 0.06);
    border-color: rgba(6, 182, 212, 0.15);
}

/* ── Main content push below fixed appbar ────────────────────────── */
.ha-main {
    padding-top: 64px;
}

/* ── Hero section (Home) ────────────────────────────────────────── */
.ha-hero {
    background: linear-gradient(160deg, #020617 0%, #0f172a 35%, #0c2d48 65%, #064e5e 100%);
    color: white;
    padding: 100px 0 120px;
    min-height: 85vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.ha-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.ha-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Page hero (subpages) ───────────────────────────────────────── */
.ha-page-hero {
    padding: 72px 0 56px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

/* ── Sections ───────────────────────────────────────────────────── */
.ha-section {
    padding: 96px 0;
}

.ha-section-alt {
    padding: 96px 0;
    background: #f8fafc;
}

/* ── Section headers ────────────────────────────────────────────── */
.ha-section-label {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase;
    color: #06b6d4 !important;
    margin-bottom: 8px !important;
}

.ha-section-title {
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    line-height: 1.2 !important;
    color: #0f172a !important;
}

.ha-section-subtitle {
    max-width: 560px;
    margin: 0 auto;
    color: #64748b !important;
}

/* ── CTA section ────────────────────────────────────────────────── */
.ha-cta {
    padding: 96px 0;
    background: linear-gradient(160deg, #020617 0%, #0f172a 40%, #0c2d48 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.ha-cta::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.ha-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 32px;
    transition: all 0.3s ease;
    background: white;
    height: 100%;
}

.ha-card:hover {
    border-color: #a5f3fc;
    box-shadow: 0 8px 32px rgba(6, 182, 212, 0.08);
    transform: translateY(-2px);
}

.ha-card-accent {
    border: 1px solid #e5e7eb;
    border-left: 3px solid #06b6d4;
    border-radius: 12px;
    padding: 24px 28px;
    transition: all 0.3s ease;
    background: white;
}

.ha-card-accent:hover {
    border-color: #a5f3fc;
    border-left-color: #06b6d4;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.08);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.ha-btn-primary {
    border-radius: 10px !important;
    text-transform: none !important;
    font-weight: 600 !important;
    padding: 12px 32px !important;
    font-size: 0.95rem !important;
    letter-spacing: 0 !important;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3) !important;
    transition: all 0.2s ease !important;
}

.ha-btn-primary:hover {
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4) !important;
    transform: translateY(-1px);
}

.ha-btn-outline {
    border-radius: 10px !important;
    text-transform: none !important;
    font-weight: 600 !important;
    padding: 12px 32px !important;
    font-size: 0.95rem !important;
    letter-spacing: 0 !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    transition: all 0.2s ease !important;
}

.ha-btn-outline:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

/* ── Badge / chip ──────────────────────────────────────────────── */
.ha-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.15);
}

.ha-badge-light {
    background: rgba(6, 182, 212, 0.15);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ── Partner strip ─────────────────────────────────────────────── */
.ha-trusted {
    padding: 48px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

/* ── Feature icon container ────────────────────────────────────── */
.ha-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.08);
    flex-shrink: 0;
}

/* ── Screenshot placeholder ─────────────────────────────────────── */
.ha-screenshot-placeholder {
    background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.ha-footer {
    background: #020617;
    color: #94a3b8;
    padding: 56px 0 36px;
}

.ha-footer a, .ha-footer .mud-link {
    color: #94a3b8 !important;
    transition: color 0.2s ease;
}

.ha-footer a:hover, .ha-footer .mud-link:hover {
    color: #e2e8f0 !important;
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.ha-animate {
    animation: fadeInUp 0.6s ease-out forwards;
}

.ha-animate-delay-1 { animation-delay: 0.1s; opacity: 0; }
.ha-animate-delay-2 { animation-delay: 0.2s; opacity: 0; }
.ha-animate-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* ── Dashboard Preview ──────────────────────────────────────────── */
.preview-dashboard {
    position: relative;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    padding: 20px;
    overflow: hidden;
    min-height: 420px;
}

.preview-live-badge {
    position: absolute;
    top: 12px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #16a34a;
    opacity: 0.85;
    z-index: 2;
    pointer-events: none;
}

.preview-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
    animation: previewPulse 2s ease-in-out infinite;
}

@keyframes previewPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.preview-widget {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.preview-widget-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-widget-body {
    padding: 12px;
    flex: 1;
    min-height: 0;
}

/* Stat rows (Machine Overview) */
.preview-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f1f5f9;
}

.preview-stat-row:last-child { border-bottom: none; }

.preview-stat-row-left {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
}

.preview-stat-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

/* Values that update live */
.preview-value-highlight {
    color: #0f172a;
}

/* Gauge */
.preview-gauge-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.preview-gauge-unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
}

.preview-gauge-label {
    font-size: 0.65rem;
    color: #94a3b8;
}

/* Counter */
.preview-counter-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.preview-counter-label {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* OEE Ring */
.preview-oee-ring {
    width: 110px;
    height: 110px;
}

.preview-oee-svg { width: 100%; height: 100%; }
.preview-oee-value { font-size: 1.4rem; font-weight: 700; fill: #0f172a; }
.preview-oee-label { font-size: 0.6rem; font-weight: 600; fill: #94a3b8; text-transform: uppercase; letter-spacing: 0.08em; }

.preview-apq-row {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

.preview-apq-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-apq-value { font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.preview-apq-label { font-size: 0.6rem; font-weight: 600; color: #94a3b8; }

/* Sparkline */
.preview-sparkline-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.preview-sparkline-svg {
    width: 100%;
    height: 40px;
}

/* Event table */
.preview-event-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    table-layout: fixed;
}

.preview-event-table tr {
    height: 32px;
}

.preview-event-table th {
    text-align: left;
    padding: 6px 10px;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.preview-event-table td {
    padding: 6px 10px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-event-time {
    font-variant-numeric: tabular-nums;
    color: #94a3b8 !important;
    font-size: 0.68rem;
}

.preview-event-mono {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 0.68rem;
    color: #0f172a !important;
}

.preview-event-new {
    background: transparent;
}

/* Responsive */
@media (max-width: 768px) {
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .preview-dashboard {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .preview-grid {
        grid-template-columns: 1fr;
    }
    .preview-widget[style*="span 2"] {
        grid-column: span 1 !important;
    }
}

/* ── Error UI ───────────────────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-bound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zIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ── Contact Form ──────────────────────────────────────────────── */
.ha-contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ha-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ha-form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.ha-form-group input,
.ha-form-group textarea {
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
    resize: vertical;
}

.ha-form-group input:focus,
.ha-form-group textarea:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.1);
}

.ha-form-group input::placeholder,
.ha-form-group textarea::placeholder {
    color: #94a3b8;
}

.ha-form-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 16px;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ha-hero {
        padding: 60px 16px 80px;
        min-height: 70vh;
    }
    .ha-page-hero {
        padding: 48px 16px 36px;
    }
    .ha-section, .ha-section-alt {
        padding: 64px 0;
    }
    .ha-cta {
        padding: 64px 0;
    }
    .ha-card {
        padding: 24px;
    }
}
