/* ============================================
   DETAILSTOCK CALCULATOR - Light Theme PWA
   Colors matching detailstock.com
   ============================================ */
:root {
    --bg: #ffffff;
    --bg2: #f5f5f5;
    --bg3: #e8e8e8;
    --card: #ffffff;
    --border: #d5d5d5;
    --purple: #7B2D8E;
    --purple-light: #9B59B6;
    --purple-dark: #5B1A6E;
    --yellow: #F4D03F;
    --yellow-dark: #C8A415;
    --dark: #1a1a1a;
    --green: #27ae60;
    --wa: #25d366;
    --text: #1a1a1a;
    --text2: #555;
    --text3: #888;
    --grad: linear-gradient(135deg, #7B2D8E, #F4D03F);
    --grad2: linear-gradient(135deg, #F4D03F, #7B2D8E);
    --shadow: 0 2px 12px rgba(0,0,0,0.1);
    --shadow2: 0 4px 24px rgba(0,0,0,0.14);
    --r: 12px;
    --tr: 0.3s cubic-bezier(0.4,0,0.2,1);
    --font: 'Inter', system-ui, sans-serif;
    --fontH: 'Space Grotesk', var(--font);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { background: var(--bg2); }

body {
    font-family: var(--font);
    background: var(--bg2);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.header-logo { display: flex; align-items: center; }
.header-logo-img { height: 44px; width: auto; }

.header-wa {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--wa);
    color: #fff;
    border-radius: 50%;
    font-size: 1.2rem;
    transition: transform var(--tr);
    box-shadow: 0 2px 10px rgba(37,211,102,0.3);
}
.header-wa:hover { transform: scale(1.08); }

/* ===== MAIN APP ===== */
.app {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 16px 100px;
}

/* App logo */
.app-logo {
    text-align: center;
    margin-bottom: 12px;
}

.app-logo img {
    height: 70px;
    width: auto;
    margin: 0 auto;
}

.app-title {
    text-align: center;
    margin-bottom: 20px;
}

.app-title h1 {
    font-family: var(--fontH);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.app-title h1 span {
    color: var(--purple);
}

.app-title p {
    color: var(--text3);
    font-size: 0.85rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.card-step {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--purple);
    color: #fff;
    font-family: var(--fontH);
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.card-step.done {
    background: var(--green);
}

.card-header h2 {
    font-family: var(--fontH);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.card-hint {
    color: var(--text3);
    font-size: 0.8rem;
    margin-bottom: 12px;
    text-align: center;
}

/* ===== RATIO GRID ===== */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.ratio-btn {
    padding: 12px 4px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--r);
    color: var(--text2);
    font-family: var(--fontH);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tr);
    text-align: center;
}

.ratio-btn:hover {
    border-color: var(--purple);
    color: var(--purple-dark);
    background: #f5f0ff;
}

.ratio-btn.active {
    background: var(--purple);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(123,45,142,0.3);
}

/* Custom ratio */
.custom-ratio { text-align: center; }

.custom-toggle {
    color: var(--purple-dark);
    font-size: 0.84rem;
    font-weight: 500;
    padding: 8px 16px;
    transition: opacity var(--tr);
}
.custom-toggle:hover { opacity: 0.7; }

.custom-ratio-input {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.ratio-display {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 10px 20px;
    width: 100%;
    max-width: 180px;
}

.ratio-1 {
    font-family: var(--fontH);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--purple-dark);
}

.ratio-sep {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text3);
}

.ratio-val {
    font-family: var(--fontH);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--yellow-dark);
    background: none;
    border: none;
    outline: none;
    width: 60px;
    text-align: center;
    -moz-appearance: textfield;
}
.ratio-val::-webkit-inner-spin-button,
.ratio-val::-webkit-outer-spin-button { -webkit-appearance: none; }

.ratio-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 260px;
    height: 6px;
    background: var(--bg3);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.ratio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px;
    background: var(--purple);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(123,45,142,0.3);
}

/* ===== WATER GRID ===== */
.water-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.water-btn {
    padding: 12px 4px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--r);
    color: var(--text2);
    font-family: var(--fontH);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tr);
    text-align: center;
}

.water-btn:hover {
    border-color: var(--purple);
    color: var(--purple-dark);
    background: #f5f0ff;
}

.water-btn.active {
    background: var(--yellow-dark);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(200,164,21,0.3);
}

/* Custom water input */
.water-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 8px 14px;
}

.water-minus, .water-plus {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--purple-dark);
    font-size: 0.9rem;
    transition: all var(--tr);
}
.water-minus:hover, .water-plus:hover {
    background: #f5f0ff;
    border-color: var(--purple);
}

.water-input {
    flex: 1;
    text-align: center;
    font-family: var(--fontH);
    font-size: 1.5rem;
    font-weight: 700;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    -moz-appearance: textfield;
}
.water-input::-webkit-inner-spin-button,
.water-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.water-unit {
    color: var(--text3);
    font-size: 0.88rem;
    font-weight: 500;
}

/* Size row with unit selector */
.size-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.size-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 6px 10px;
}

.size-btn-minus, .size-btn-plus {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--purple-dark);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--tr);
    flex-shrink: 0;
}
.size-btn-minus:hover, .size-btn-plus:hover {
    background: #f5f0ff;
    border-color: var(--purple);
}

.size-input {
    flex: 1;
    text-align: center;
    font-family: var(--fontH);
    font-size: 1.4rem;
    font-weight: 700;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    -moz-appearance: textfield;
    min-width: 0;
}
.size-input::-webkit-inner-spin-button,
.size-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.unit-select {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    min-width: 110px;
}

.unit-select:focus {
    border-color: var(--purple);
    outline: none;
}

.quick-sizes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.quick-size {
    padding: 10px 4px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--r);
    color: var(--text2);
    font-family: var(--fontH);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tr);
    text-align: center;
}

.quick-size:hover {
    border-color: var(--purple);
    color: var(--purple-dark);
    background: #f5f0ff;
}

.quick-size.active {
    background: var(--yellow-dark);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(200,164,21,0.3);
}

/* Total circle in result */
.total-circle {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--bg2);
    border: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.total-circle span {
    font-family: var(--fontH);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.total-circle small {
    font-size: 0.55rem;
    color: var(--text3);
    text-transform: uppercase;
}

.total-label { color: var(--text) !important; }

/* Save button */
.save-btn {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: var(--r);
    font-family: var(--fontH);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--tr);
    box-shadow: 0 3px 14px rgba(123,45,142,0.25);
}

.save-btn:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.save-btn:active {
    transform: scale(0.98);
}

/* ===== RESULT CARD ===== */
.result-card {
    border-color: var(--border);
    background: #fff;
    text-align: center;
    box-shadow: var(--shadow2);
}

/* Gauge */
.gauge-wrap {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 0 auto 16px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 10px rgba(123,45,142,0.15));
}

.gauge-progress {
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4,0,0.2,1);
}

.gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-num {
    font-family: var(--fontH);
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--purple);
    line-height: 1;
}

.gauge-unit {
    font-family: var(--fontH);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text2);
}

.gauge-sub {
    font-size: 0.75rem;
    color: var(--text3);
    margin-top: 2px;
}

/* Bottles */
.bottles {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.bottle-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bottle-col strong {
    font-family: var(--fontH);
    font-size: 0.9rem;
    font-weight: 700;
    color: #5B1A6E;
}

.bottle-col.product strong { color: #C8A415; }

.bottle-col small {
    font-size: 0.65rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bottle-svg {
    width: 56px;
    height: 100px;
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.15));
}

.bottle-sm { width: 40px; }

.bottle-op {
    font-family: var(--fontH);
    font-weight: 700;
    color: var(--text3);
    font-size: 1rem;
    padding-bottom: 32px;
}

.mix-check {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(39,174,96,0.1);
    border: 2px solid rgba(39,174,96,0.3);
    display: flex; align-items: center; justify-content: center;
    color: var(--green);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.mix-text { color: var(--green) !important; }

/* Liquid animations */
.water-fill, .product-fill {
    transition: y 0.6s ease, height 0.6s ease;
}
.water-wave { animation: waveBob 3s ease-in-out infinite; }
.product-wave { animation: waveBob 3.5s ease-in-out infinite reverse; }

@keyframes waveBob {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-3px); }
}

/* Result pill */
.result-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(39,174,96,0.08);
    border: 1px solid rgba(39,174,96,0.2);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--green);
    font-weight: 500;
}

/* ===== INSTALL BANNER ===== */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    justify-content: center;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 500px;
    width: 100%;
    flex-wrap: wrap;
}

.install-icon {
    width: 56px;
    height: auto;
    flex-shrink: 0;
}

.install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.install-text strong {
    font-size: 0.92rem;
    color: var(--text);
}

.install-text span {
    font-size: 0.78rem;
    color: var(--text3);
}

.install-btn {
    padding: 10px 20px;
    background: var(--purple);
    color: #fff;
    border-radius: var(--r);
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(123,45,142,0.25);
    transition: all var(--tr);
}

.install-btn:hover {
    box-shadow: 0 4px 16px rgba(123,45,142,0.35);
    transform: translateY(-1px);
}

.install-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text3);
    font-size: 1rem;
    flex-shrink: 0;
}

.ios-steps {
    width: 100%;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.ios-steps p {
    font-size: 0.88rem;
    color: var(--text2);
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ios-steps strong {
    color: var(--text);
}

.ios-steps i {
    color: var(--purple);
}

.ios-chrome-notice {
    background: #fff8e1;
    border: 1px solid #ffd54f;
    border-radius: var(--r);
    padding: 14px;
    margin-bottom: 12px;
}

.ios-chrome-notice p {
    font-size: 0.85rem;
    color: var(--text2);
    padding: 4px 0;
}

.ios-chrome-notice i.fa-exclamation-circle {
    color: #f59e0b;
}

.ios-chrome-notice i.fa-safari {
    color: #0077ed;
}

.ios-url-copy strong {
    background: var(--bg2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    word-break: break-all;
}

/* ===== FOOTER ===== */
.app-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 28px;
    text-align: center;
}

.footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
    transition: all var(--tr);
    box-shadow: var(--shadow);
}

.footer-link:hover {
    border-color: var(--purple);
    background: #f5f0ff;
}

.footer-link.install {
    background: var(--purple);
    color: #fff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 3px 14px rgba(123,45,142,0.3);
}

.footer-link.install:hover {
    box-shadow: 0 5px 20px rgba(123,45,142,0.4);
    background: var(--purple-dark);
}

.footer-link.wa {
    background: rgba(37,211,102,0.06);
    border-color: rgba(37,211,102,0.25);
    color: #1a8e3e;
}

.footer-link.wa:hover {
    background: rgba(37,211,102,0.12);
    border-color: var(--wa);
}

/* Social links */
.social-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 6px;
}

.social-link {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
    color: #fff;
    transition: all var(--tr);
    text-decoration: none;
}

.social-link:hover {
    transform: scale(1.1);
}

.social-link.instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.social-link.facebook {
    background: #1877F2;
}

.social-link.youtube {
    background: #FF0000;
}

.social-link.tiktok {
    background: #000000;
}

.footer-brand {
    margin-top: 14px;
    opacity: 0.4;
}

.footer-logo {
    height: 26px;
    margin: 0 auto 4px;
    display: block;
}

.footer-brand p {
    font-size: 0.72rem;
    color: var(--text3);
}

/* ===== WHATSAPP FLOAT ===== */
.wa-float {
    position: fixed;
    bottom: 18px;
    right: 18px;
    width: 52px; height: 52px;
    background: var(--wa);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(37,211,102,0.35);
    transition: transform var(--tr);
    animation: waPulse 2.5s ease-out infinite;
}

.wa-float:hover { transform: scale(1.08); }

@keyframes waPulse {
    0% { box-shadow: 0 4px 16px rgba(37,211,102,0.35); }
    50% { box-shadow: 0 4px 16px rgba(37,211,102,0.35), 0 0 0 8px rgba(37,211,102,0.08); }
    100% { box-shadow: 0 4px 16px rgba(37,211,102,0.35), 0 0 0 16px rgba(37,211,102,0); }
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
    .app { max-width: 520px; padding: 28px 24px 80px; }
    .app-title h1 { font-size: 1.7rem; }
    .card { padding: 24px; }
    .water-grid { grid-template-columns: repeat(6, 1fr); }
    .gauge-wrap { width: 210px; height: 210px; }
    .gauge-num { font-size: 2.8rem; }
    .bottle-svg { width: 60px; height: 105px; }
    .bottle-sm { width: 46px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
