/* MjengoCalc — Modern Dark UI */

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #1a1d24;
    --bg-card: #21252e;
    --bg-card-hover: #282d38;
    --surface: #2a2f3a;
    --border: #353b48;
    --border-active: #7c83f5;
    --text: #ffffff;
    --text-muted: #b4b9c6;
    --text-dim: #8a90a0;
    --accent: #8b93f7;
    --accent-glow: rgba(123, 131, 245, 0.1);
    --accent-gradient: linear-gradient(135deg, #6366f1, #a78bfa);
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251, 191, 36, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Background Effects ── */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(26,29,36,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span { color: var(--accent); }

.header-badge {
    font-size: 13px;
    padding: 5px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 60px 0 40px;
    position: relative;
    z-index: 1;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-glow);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 20px;
    font-size: 14px;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 20px;
}

.hero-pill .dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero h1 {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #c0c4ce 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero h1 .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* ── Calculator Card ── */
.calc-section { position: relative; z-index: 1; padding-bottom: 40px; }

.calc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.calc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-gradient);
}

.calc-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-weight: 600;
}

/* ── Form ── */
.form-group { margin-bottom: 28px; }

.form-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.form-label .hint {
    font-weight: 400;
    color: var(--text-dim);
    font-size: 13px;
}

/* ── Options Grid ── */
.options-row { display: grid; gap: 8px; }
.options-row.house-types { grid-template-columns: repeat(5, 1fr); }
.options-row.finish-levels { grid-template-columns: repeat(2, 1fr); }

.opt-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: transparent;
    position: relative;
}

.opt-card:hover {
    border-color: #3f3f50;
    background: var(--bg-card-hover);
}

.opt-card.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 20px rgba(99,102,241,0.1);
}

.opt-card.selected::after {
    content: '✓';
    position: absolute;
    top: 6px; right: 8px;
    font-size: 10px;
    color: var(--accent);
    font-weight: 700;
}

.opt-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.opt-sub { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

/* ── Select ── */
.select-wrap { position: relative; }

.select-wrap select {
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
    cursor: pointer;
    appearance: none;
    outline: none;
    transition: border-color 0.2s;
}

.select-wrap select:focus { border-color: var(--accent); }

.select-wrap::after {
    content: '▾';
    position: absolute;
    right: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.select-wrap select option { background: var(--bg-card); color: var(--text); }

/* ── Input ── */
.input-group {
    display: flex;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.2s;
}

.input-group:focus-within { border-color: var(--accent); }

.input-prefix {
    padding: 14px 16px;
    background: var(--surface);
    font-weight: 600;
    font-size: 16px;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
}

.input-group input {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
    outline: none;
    min-width: 0;
}

.input-group input::placeholder { color: var(--text-dim); }

/* ── CTA Button ── */
.cta-btn {
    width: 100%;
    padding: 18px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 17px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.cta-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(99,102,241,0.35);
}

.cta-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Results ── */
.results-section { position: relative; z-index: 1; padding-bottom: 60px; }

.total-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.total-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-gradient);
}

.total-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.total-amount {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    line-height: 1;
}

.total-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-chip {
    font-size: 14px;
    padding: 5px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
}

.cost-sqm {
    margin-top: 16px;
    font-size: 15px;
    color: var(--text-dim);
}

.cost-sqm strong { color: var(--text); }

/* ── Budget ── */
.budget-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.budget-header h4 { font-size: 18px; }

.budget-pct {
    font-size: 26px;
    font-weight: 800;
    color: var(--accent);
}

.progress-track {
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.progress-fill.enough { background: var(--green); }
.progress-fill.partial { background: var(--accent); }

.budget-note { font-size: 14px; color: var(--text-muted); }

/* ── Phases ── */
.phases-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}

.card-header h3 { font-size: 20px; font-weight: 700; }
.card-header .hint { font-size: 13px; color: var(--text-dim); }

.phase-row {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    gap: 12px;
}

.phase-row:last-child { border-bottom: none; }

.phase-icon { font-size: 22px; width: 36px; text-align: center; flex-shrink: 0; }

.phase-info { flex: 1; min-width: 0; }

.phase-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }

.phase-desc {
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phase-right { text-align: right; flex-shrink: 0; }

.phase-cost { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.phase-pct { font-size: 12px; color: var(--text-dim); }

.phase-tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
}

.tag-ok { background: var(--green-dim); color: var(--green); }
.tag-part { background: var(--yellow-dim); color: var(--yellow); }
.tag-no { background: rgba(255,255,255,0.04); color: var(--text-dim); }

/* ── Materials ── */
.materials-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.mat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.mat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: var(--radius-xs);
    font-size: 14px;
    gap: 8px;
}

.mat-name { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-price { font-weight: 700; color: var(--text); white-space: nowrap; }

/* ── Share ── */
.share-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    margin-bottom: 16px;
}

.share-card h3 { font-size: 18px; margin-bottom: 16px; }

.share-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.share-btn {
    padding: 12px 22px;
    border-radius: var(--radius-xs);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: var(--font);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.share-btn:hover { transform: translateY(-1px); }
.share-btn.wa { background: #25d366; color: white; }
.share-btn.fb { background: #1877f2; color: white; }
.share-btn.cp { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ── Recalculate ── */
.recalc-wrap { text-align: center; margin-bottom: 20px; }

.recalc-btn {
    padding: 14px 32px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.recalc-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Content / SEO ── */
.content-section { position: relative; z-index: 1; padding: 20px 0 60px; }

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.content-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 16px; }
.content-card h3 { font-size: 18px; font-weight: 700; margin: 24px 0 10px; color: var(--accent); }
.content-card p { color: var(--text-muted); margin-bottom: 12px; font-size: 16px; line-height: 1.7; }
.content-card strong { color: var(--text); }
.content-card ul { margin: 12px 0 12px 20px; color: var(--text-muted); font-size: 16px; line-height: 1.7; }
.content-card li { margin-bottom: 8px; }

.data-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { color: var(--text); }

/* ── Footer ── */
.footer {
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer p { font-size: 14px; color: var(--text-dim); margin-bottom: 6px; }

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.5s ease forwards; }
.d1 { animation-delay: 0.1s; opacity: 0; }
.d2 { animation-delay: 0.2s; opacity: 0; }
.d3 { animation-delay: 0.3s; opacity: 0; }
.d4 { animation-delay: 0.4s; opacity: 0; }

/* ── Mobile ── */
@media (max-width: 640px) {
    .hero { padding: 40px 0 28px; }
    .hero h1 { font-size: 30px; letter-spacing: -1px; }
    .hero-sub { font-size: 15px; }
    .options-row.house-types { grid-template-columns: repeat(3, 1fr); }
    .options-row.finish-levels { grid-template-columns: 1fr; }
    .opt-card { padding: 12px 8px; }
    .opt-title { font-size: 13px; }
    .opt-sub { font-size: 10px; }
    .calc-card { padding: 20px; }
    .total-amount { font-size: 38px; }
    .meta-chip { font-size: 11px; padding: 3px 8px; }
    .mat-grid { grid-template-columns: 1fr; }
    .share-row { flex-direction: column; }
    .share-btn { justify-content: center; }
    .content-card { padding: 20px; }
    .phase-desc { display: none; }
    .header-badge { display: none; }
}

@media (max-width: 380px) {
    .options-row.house-types { grid-template-columns: repeat(2, 1fr); }
    .total-amount { font-size: 32px; }
    .hero h1 { font-size: 26px; }
}
