/*
 * Hooshmand Sarma — customer-facing pages (home, request form, portal).
 * Same language as the admin theme: glacier band, frost surface, and the
 * copper→ice "cycle line" as the one signature accent.
 */

@import url('fonts.css');

:root {
    --glacier: #0b2534;
    --glacier-2: #12364a;
    --ink: #10242f;
    --muted: #587080;
    --line: #d5e2e8;
    --line-soft: #e6eef2;
    --page: #eef4f6;
    --card: #ffffff;
    --field: #f7fafb;
    --accent: #13809a;
    --accent-dark: #0d6378;
    --accent-soft: #e2f2f6;
    --ice: #bfe8f2;
    --copper: #c46a35;
    --copper-soft: #fbeee5;
    --success: #1d7a52;
    --success-soft: #e3f3ea;
    --warn: #96600c;
    --warn-soft: #fbf0da;
    --danger: #b4232c;
    --danger-soft: #fdf0f1;
    --cycle: linear-gradient(to left, var(--copper), #2a9ab4 55%, var(--ice));
    --shadow: 0 1px 2px rgb(11 37 52 / 0.05), 0 14px 34px -18px rgb(11 37 52 / 0.25);
    --radius: 16px;
    --surface-2: #f4f8f9;
    --track: #e2ecf0;
    --field-focus: #ffffff;
    --line-hover: #b9cfd8;
    --heading: var(--glacier);
    --accent-hover: #0d6378;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e3edf1;
        --muted: #93abb6;
        --line: #2a4554;
        --line-soft: #1f3846;
        --page: #081b26;
        --card: #0f2633;
        --field: #0b2130;
        --accent: #3aa9c4;
        --accent-dark: #7fd0e3;
        --accent-soft: #123a4a;
        --copper-soft: #3a2518;
        --success: #5cc99a;
        --success-soft: #133829;
        --warn: #e6b45c;
        --warn-soft: #3a2c12;
        --danger: #f08a8f;
        --danger-soft: #3d171b;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 14px 34px -18px rgb(0 0 0 / 0.7);
        --surface-2: #0b2130;
        --track: #0b2130;
        --field-focus: #0d2737;
        --line-hover: #3b5b6b;
        --heading: #ffffff;
        --accent-hover: #2b8ea8;
        color-scheme: dark;
    }
}

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

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background: var(--page);
    color: var(--ink);
    line-height: 1.85;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
::selection { background: var(--ice); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Glacier band ---------- */

.band {
    position: relative;
    background:
        radial-gradient(600px 300px at 0% 120%, rgb(42 154 180 / 0.28), transparent 70%),
        radial-gradient(500px 260px at 100% -40%, rgb(196 106 53 / 0.22), transparent 70%),
        var(--glacier);
    color: #e6f1f5;
    overflow: hidden;
}

.band::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    background: var(--cycle);
}

.band .coil {
    position: absolute;
    inset-inline-end: -40px;
    top: 50%;
    width: 260px;
    height: 430px;
    transform: translateY(-50%);
    background: url('coil.svg') no-repeat center / contain;
    opacity: 0.55;
    pointer-events: none;
}

body.portal .band .coil { display: none; }

.band-inner {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding: 18px 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
}

.brand:hover { color: #fff; }

.brand svg { width: 36px; height: 36px; flex: none; }

.brand small {
    display: block;
    font-weight: 400;
    font-size: 0.78rem;
    color: #a9c4cf;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f0b48c;
}

.eyebrow::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 99px;
    background: var(--copper);
    box-shadow: 0 0 0 4px rgb(196 106 53 / 0.25);
}

/* ---------- Shared controls ---------- */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

label { font-weight: 600; font-size: 0.9rem; }
label .req { color: var(--copper); margin-inline-start: 3px; }

input[type="text"], input[type="tel"], input[type="email"], select, textarea {
    font: inherit;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--field);
    color: var(--ink);
    width: 100%;
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

input[type="text"]:hover, input[type="tel"]:hover, input[type="email"]:hover, select:hover, textarea:hover {
    border-color: var(--line-hover);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    background: var(--field-focus);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(19 128 154 / 0.14);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23587080'%3E%3Cpath d='M5.2 7.5a.75.75 0 0 1 1.06 0L10 11.2l3.74-3.7a.75.75 0 1 1 1.06 1.06l-4.27 4.24a.75.75 0 0 1-1.06 0L5.2 8.56a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 18px;
    padding-inline-end: 40px;
}

textarea { min-height: 130px; resize: vertical; }

input[type="file"] {
    font: inherit;
    font-size: 0.9rem;
    width: 100%;
    padding: 18px 16px;
    border: 1.5px dashed var(--line-hover);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
}

input[type="file"]:hover { border-color: var(--accent); }

input[type="file"]::file-selector-button {
    font: inherit;
    font-weight: 600;
    margin-inline-end: 12px;
    padding: 6px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--glacier);
    color: #fff;
    cursor: pointer;
}

.hint { color: var(--muted); font-size: 0.8rem; }
.error { color: var(--danger); font-size: 0.85rem; }

.btn, button[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 10px 22px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 8px 18px -10px rgb(19 128 154 / 0.9), inset 0 1px 0 rgb(255 255 255 / 0.18);
    transition: background-color 120ms ease, transform 120ms ease;
}

.btn:hover, button[type="submit"]:hover { background: var(--accent-hover); color: #fff; }
.btn:active, button[type="submit"]:active { transform: translateY(1px); }

.btn.ghost { background: var(--card); color: var(--accent-dark); border: 1px solid var(--accent); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.success { background: var(--success); box-shadow: 0 8px 18px -10px rgb(29 122 82 / 0.9); }
.btn.success:hover { background: #166240; }
.btn.warn { background: var(--card); color: var(--warn); border: 1px solid #d9b26b; box-shadow: none; }
.btn.warn:hover { background: var(--warn-soft); }
.btn.dark { background: var(--glacier); box-shadow: 0 8px 18px -10px rgb(11 37 52 / 0.9); }
.btn.dark:hover { background: var(--glacier-2); }

@media (prefers-color-scheme: dark) {
    .btn.dark { box-shadow: inset 0 0 0 1px var(--line-hover); }
    .band { box-shadow: 0 1px 0 var(--line-soft); }
}

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.card-surface {
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- Request form ---------- */

body.intake .band-inner { padding-bottom: 112px; }

body.intake .hero { margin-top: 34px; max-width: 560px; }

body.intake .hero h1 {
    margin: 10px 0 8px;
    font-size: clamp(1.6rem, 4vw, 2.15rem);
    line-height: 1.45;
    color: #fff;
}

body.intake .hero p { margin: 0; color: #b8cfd8; font-size: 0.98rem; }

body.intake main {
    position: relative;
    max-width: 760px;
    margin: -84px auto 0;
    padding: 30px 28px;
}

body.intake .wrap { padding: 0 16px 56px; }

body.intake .form-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

body.intake .form-head h2 { margin: 0; font-size: 1.1rem; }

body.intake .steps {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.78rem;
    color: var(--muted);
}

body.intake .steps li { display: inline-flex; align-items: center; gap: 6px; }
body.intake .steps li + li::before { content: '←'; color: #9db5bf; }
body.intake .steps li:first-child { color: var(--accent-dark); font-weight: 600; }

.errors {
    background: var(--danger-soft);
    border: 1px solid #f1c3c7;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 0.9rem;
    color: var(--danger);
}

.errors ul { margin: 6px 0 0; padding-inline-start: 18px; }

body.intake .actions {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

body.intake .actions button[type="submit"] { padding: 12px 28px; font-size: 1rem; }

.counter { color: var(--copper); font-weight: 600; }

.quick-products { display: flex; flex-wrap: wrap; gap: 6px; }

.quick-product {
    font: inherit;
    font-size: 0.8rem;
    padding: 2px 11px;
    border-radius: 999px;
    border: 1px dashed var(--line-hover);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.quick-product::before { content: '+ '; color: var(--copper); }
.quick-product:hover { border-style: solid; border-color: var(--accent); color: var(--accent-dark); }

.draft-note {
    margin: 18px 0 0;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.8rem;
}

.draft-note button {
    font: inherit;
    margin-inline-start: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.file-list:empty { display: none; }

.file-list li {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    max-width: 100%;
    padding: 4px 12px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 0.84rem;
}

.file-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.file-list li small { color: var(--muted); white-space: nowrap; }
.file-list li.too-big { background: var(--danger-soft); color: var(--danger); }

button[type="submit"].is-sending { opacity: 0.75; cursor: progress; }

body.intake .thanks { text-align: center; padding: 14px 0 6px; }
body.intake .thanks h1 { margin: 12px 0 8px; font-size: 1.4rem; }
body.intake .thanks p { color: var(--muted); }

.thanks-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: var(--success-soft);
    color: var(--success);
}

.thanks-mark svg { width: 30px; height: 30px; }
.thanks-mark.warn { background: var(--warn-soft); color: var(--warn); }
.thanks-mark.info { background: var(--accent-soft); color: var(--accent-dark); }

.thanks-mark { animation: pop 420ms cubic-bezier(.2,1.4,.4,1) both; }
.thanks-mark .draw { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 600ms 260ms ease-out forwards; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Customer portal ---------- */

body.portal .band-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 20px;
    padding-bottom: 20px;
}

body.portal .who { text-align: left; color: #fff; }
body.portal .who .greet { font-size: 0.8rem; color: #f0b48c; }
body.portal .who .name { font-weight: 700; }

.countdown {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: left;
}

.countdown::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-inline-end: 6px;
    border-radius: 99px;
    background: var(--accent);
    vertical-align: middle;
}

.countdown.soon { color: var(--copper); font-weight: 600; }
.countdown.soon::before { background: var(--copper); animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
    50% { box-shadow: 0 0 0 5px rgb(196 106 53 / 0.18); }
}
body.portal .who .hint { color: #a9c4cf; }

body.portal .wrap { max-width: 960px; margin: 0 auto; padding: 22px 16px 48px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }

.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 16px 18px 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 18px;
    width: 26px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--copper);
}

.card .k { color: var(--muted); font-size: 0.82rem; }
.card .v { font-weight: 700; font-size: 1.45rem; color: var(--heading); }
.card .v.small { font-size: 1.05rem; padding-top: 6px; }

.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 0.92rem; }
.flash.error { background: var(--danger-soft); border: 1px solid #f1c3c7; color: var(--danger); }
.flash.ok { background: var(--success-soft); border: 1px solid #bfe3cc; color: var(--success); }
.flash ul { margin: 6px 0 0; padding-inline-start: 18px; }

.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 18px;
    padding: 5px;
    background: var(--track);
    border-radius: 14px;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    font: inherit;
    font-size: 0.92rem;
    background: none;
    border: 0;
    border-radius: 10px;
    padding: 7px 14px;
    cursor: pointer;
    color: var(--muted);
    white-space: nowrap;
    transition: background-color 120ms ease, color 120ms ease;
}

.tab:hover { color: var(--ink); background: color-mix(in srgb, var(--card) 55%, transparent); }

.tab .n {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--card) 80%, transparent);
    color: var(--accent-dark);
    font-size: 0.76rem;
    margin-inline-start: 4px;
    text-align: center;
}

.tab.active { color: var(--heading); font-weight: 700; background: var(--card); box-shadow: 0 2px 8px -3px rgb(11 37 52 / 0.25); }
.tab.active .n { background: var(--accent-soft); }

.panel { display: none; }
.panel.active { display: block; animation: rise 220ms ease both; }

@keyframes rise {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.item {
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.item h3 { margin: 0 0 4px; font-size: 1.04rem; color: var(--heading); }
.item .sub { color: var(--muted); font-size: 0.85rem; }

.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px 16px;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: 12px;
    font-size: 0.9rem;
}

.meta div span { color: var(--muted); display: block; font-size: 0.76rem; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 11px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent-dark);
    white-space: nowrap;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: 0.7; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: var(--surface-2); color: var(--muted); }

.amount { font-weight: 700; color: var(--heading); }

.bar { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(to left, var(--accent), #5cc3d8);
    transform-origin: right;
    animation: grow 900ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes grow { from { transform: scaleX(0); } }

.phases { margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.88rem; }
.phases li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--line); }

table.lines { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.88rem; }
table.lines th, table.lines td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: right; }
table.lines th { color: var(--muted); font-weight: 500; font-size: 0.78rem; background: var(--surface-2); }
table.lines th:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
table.lines th:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }

body.portal .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.respond { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.respond .choice { display: flex; gap: 10px; flex-wrap: wrap; }
.respond details { margin-top: 10px; }
.respond summary { cursor: pointer; color: var(--accent-dark); font-weight: 700; }

.empty {
    color: var(--muted);
    text-align: center;
    padding: 34px 12px;
    background: color-mix(in srgb, var(--card) 60%, transparent);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
}

.response-box { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--success-soft); font-size: 0.9rem; }
.response-box.changes { background: var(--warn-soft); }

body.portal .thanks {
    text-align: center;
    padding: 36px 16px;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

body.portal .thanks h1 { margin: 12px 0 8px; font-size: 1.35rem; color: var(--heading); }
body.portal .thanks p { color: var(--muted); }

footer.site {
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 32px;
}

footer.site::before {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    margin: 0 auto 12px;
    border-radius: 3px;
    background: var(--cycle);
}

/* ---------- Responsive & motion ---------- */

@media (max-width: 720px) {
    .cards { grid-template-columns: 1fr 1fr; }
    .grid { grid-template-columns: 1fr; }
    body.portal .who { text-align: right; }
    body { font-size: 14.5px; }
    body.intake main { padding: 22px 18px; }
    body.intake .form-head { flex-direction: column; }
    .band .coil { opacity: 0.28; inset-inline-end: -110px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .thanks-mark .draw { stroke-dashoffset: 0; }
}
