:root {
    --bg: #f5f7fb;
    --panel: rgba(255, 255, 255, 0.8);
    --panel-strong: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --border: #e2e8f0;
    --shadow: rgba(15, 23, 42, 0.08);
    --brand: #0f172a;
    --brand-accent: #f0f4ff;
    --button: #0f172a;
    --button-hover: #1e293b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
    color: var(--text);
}

#app {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top, rgba(148, 163, 184, 0.18), transparent 38%),
        linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
}

.app-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 2rem;
    text-align: center;
}

.loader-shell {
    position: relative;
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(8px);
}

.loader-core {
    position: relative;
    z-index: 2;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 10px 30px rgba(15, 23, 42, 0.2);
    color: #fff;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.08em;
}

.loader-orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
}

.loader-orbit-one {
    border-top-color: rgba(59, 130, 246, 0.9);
    border-right-color: rgba(99, 102, 241, 0.8);
    animation: spin 1.2s linear infinite;
}

.loader-orbit-two {
    inset: 12px;
    border-left-color: rgba(14, 165, 233, 0.8);
    border-bottom-color: rgba(168, 85, 247, 0.75);
    animation: spin-reverse 1.8s linear infinite;
}

.loader-brand {
    font-size: 0.9rem;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.7);
}

.loader-text {
    font-size: 1rem;
    color: rgba(71, 85, 105, 0.95);
    letter-spacing: 0.02em;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 1rem 1rem 1rem;
    z-index: 50;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    background: rgba(127, 29, 29, 0.96);
    color: #fff;
    box-shadow: 0 18px 46px rgba(127, 29, 29, 0.25);
}

#blazor-error-ui .reload {
    color: #fff;
    text-decoration: underline;
    margin-left: 0.6rem;
}

#blazor-error-ui .dismiss {
    float: right;
    cursor: pointer;
    opacity: 0.8;
}

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

@keyframes spin-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 1.5rem 0 0.5rem;
    backdrop-filter: blur(12px);
}

.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 2rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 16px 40px var(--shadow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 1rem;
    background: var(--brand);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex: 1;
    font-size: 0.95rem;
    color: var(--muted);
}

.main-nav a {
    transition: color 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small {
    padding: 0.8rem 1.1rem;
    font-size: 0.82rem;
}

.btn-primary {
    background: var(--button);
    color: white;
    padding: 0.95rem 1.4rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.btn-primary:hover {
    background: var(--button-hover);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.95rem 1.4rem;
}

.page-content {
    padding-bottom: 3rem;
}

.hero-section,
.section,
.page-hero {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.hero-section {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    align-items: center;
    padding-top: 4rem;
    padding-bottom: 2.5rem;
}

.hero-copy h1,
.section-heading h1,
.section-heading h2 {
    margin: 0;
    color: var(--text);
    letter-spacing: -0.05em;
}

.hero-copy h1,
.section-heading h1 {
    font-size: clamp(2.7rem, 6vw, 4.3rem);
    line-height: 1.02;
}

.section-heading h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
}

.eyebrow {
    margin: 0 0 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.78rem;
    font-weight: 600;
}

.lead {
    margin-top: 1.5rem;
    max-width: 42rem;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.8;
}

.cta-row,
.center-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.hero-visual { display: flex; justify-content: center; }

.image-card {
    display: block;
    overflow: hidden;
    width: min(100%, 32rem);
    border-radius: 2rem;
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.12);
}

.image-card img,
.fact-card img,
.image-panel img,
.about-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-strip {
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.brand-strip-title {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.brand-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1.5rem 1rem;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.72);
    border-radius: 2rem;
    box-shadow: 0 10px 24px var(--shadow);
}

.brand-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4rem;
    color: rgba(15, 23, 42, 0.65);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.section-heading {
    margin-bottom: 1.5rem;
}

.section-heading.center {
    text-align: center;
}

.tips-layout,
.about-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.info-panel,
.image-panel,
.tool-card,
.contact-form-card,
.fact-card,
.contact-card {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.8);
    border-radius: 2rem;
    box-shadow: 0 12px 30px var(--shadow);
}

.info-panel {
    padding: 2rem;
}

.info-panel h3 {
    margin-top: 0;
    font-size: 1.5rem;
}

.tip-list {
    margin: 1rem 0 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.8rem;
    color: var(--muted);
    line-height: 1.75;
}

.image-panel {
    overflow: hidden;
    min-height: 22rem;
}

.image-panel img {
    height: 100%;
    min-height: 22rem;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    padding-top: 1rem;
}

.large-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fact-card {
    overflow: hidden;
}

.fact-card img {
    height: 16rem;
}

.fact-label {
    padding: 1rem 1.25rem 1.4rem;
    font-weight: 600;
    color: var(--text);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.tool-card {
    padding: 1.5rem;
}

.tool-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.tool-form {
    display: grid;
    gap: 1rem;
}

.tool-form label,
.contact-form label {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.tool-form input,
.tool-form select,
.contact-form input,
.contact-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: #fff;
    padding: 0.8rem 0.9rem;
    font: inherit;
    color: var(--text);
}

.result-box {
    margin: 0.5rem 0 0;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: var(--brand-accent);
    color: var(--text);
    line-height: 1.6;
}

.about-copy {
    color: var(--muted);
    line-height: 1.9;
    font-size: 1.05rem;
}

.about-panel {
    min-height: 24rem;
    overflow: hidden;
}

.contact-layout {
    display: grid;
    gap: 2rem;
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.contact-card {
    padding: 1.5rem;
    text-align: center;
    color: var(--muted);
}

.contact-card .icon {
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 0.8rem;
    background: var(--brand-accent);
    font-size: 1.4rem;
}

.contact-form-card {
    padding: 2rem;
}

.contact-form-card h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.contact-form {
    display: grid;
    gap: 1rem;
}

.contact-form textarea {
    min-height: 8rem;
    resize: vertical;
}

.site-footer {
    padding: 1rem 0 2.5rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1rem 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

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

.measurement-shell {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2rem;
    box-shadow: 0 18px 44px var(--shadow);
    overflow: hidden;
}

.measure-tabs {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1rem 0;
    border-bottom: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.8);
}

.measure-tab {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    padding: 0.8rem 1.1rem;
    border-radius: 0.9rem 0.9rem 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.measure-tab.active {
    background: rgba(15, 23, 42, 0.05);
    border-color: var(--border);
    border-bottom-color: transparent;
    color: var(--text);
}

.measure-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.25fr);
    min-height: 560px;
}

.measure-form-panel {
    padding: 1.5rem;
    border-right: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.58);
}

.measure-form-panel .tool-form {
    height: 100%;
    min-height: 430px;
}

.measure-result-panel {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.76) 0%, rgba(241,245,249,0.88) 100%);
}

.result-header {
    display: flex;
    justify-content: flex-start;
    padding: 1.2rem 1.5rem 0.8rem;
}

.result-header-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.result-tag,
.result-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-tag {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.result-status {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--muted);
    line-height: 1.8;
}

.assistant-bubble {
    padding: 1rem 1rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.assistant-bubble-main {
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(239,246,255,0.9));
}

.bubble-label {
    display: inline-block;
    margin-bottom: 0.7rem;
    color: #2563eb;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
}

.result-content h3 {
    margin: 0 0 0.75rem;
    color: var(--text);
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    line-height: 1.35;
}

.result-content p,
.result-content li {
    font-size: 0.98rem;
}

.result-content ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.result-content li + li {
    margin-top: 0.5rem;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 1.5rem 1.5rem;
}

.result-actions .btn-secondary {
    min-width: 120px;
}

.measure-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.25rem;
}

.measure-modal {
    width: min(680px, 92vw);
    max-height: 80vh;
    overflow: auto;
    border-radius: 1.5rem;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    color: var(--text);
}

.modal-close {
    appearance: none;
    border: none;
    background: rgba(15, 23, 42, 0.06);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    color: var(--muted);
    line-height: 1.8;
}

.modal-body h4 {
    margin: 0 0 0.75rem;
    color: var(--text);
    font-size: 1.4rem;
}

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

    .hero-section,
    .tips-layout,
    .about-layout,
    .facts-grid,
    .tool-grid,
    .contact-cards,
    .measure-layout {
        grid-template-columns: 1fr;
    }

    .measure-layout {
        display: grid;
    }

    .measure-form-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .nav-actions {
        display: none;
    }
}

@media (max-width: 640px) {
    .brand-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .hero-section {
        padding-top: 3rem;
    }

    .site-header {
        padding-top: 1rem;
    }

    .nav-shell {
        padding: 0.8rem 1rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .measure-tabs {
        overflow-x: auto;
    }

    .measure-tab {
        white-space: nowrap;
    }
}
