/* ====================================================
   ENCAJA.APP — Calculator Base Styles v2.0
   Tipografía: Syne (display) + Inter (body)
   Paleta: Charcoal / Ámbar / Blanco tiza
==================================================== */

/* ====================================================
   IMPORT FONTS
==================================================== */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=Inter:wght@300;400;500;600&display=swap');

/* ====================================================
   VARIABLES
==================================================== */
:root {
    /* Paleta base */
    --ink:        #111010;
    --clay:       #D97706;
    --clay-dark:  #B45309;
    --clay-light: #FEF3C7;
    --sage:       #065F46;
    --chalk:      #FAFAF8;
    --stone:      #F2F0EB;
    --mist:       #DDD9CF;
    --dust:       #7C7B77;
    --white:      #FFFFFF;

    /* Semánticos */
    --success:    #059669;
    --warning:    #D97706;
    --danger:     #DC2626;
    --info:       #2563EB;

    /* Por calculadora */
    --c-muros:       #B45309;
    --c-pintura:     #7C3AED;
    --c-madera:      #065F46;
    --c-pavimentos:  #1D4ED8;
    --c-yeso:        #BE185D;

    /* Tipografía */
    --font-display: 'Syne', sans-serif;
    --font-body:    'Inter', sans-serif;

    /* Espaciado */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
    --space-xl: 56px;

    /* Radio */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg: 16px;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(17,16,16,.08), 0 1px 2px rgba(17,16,16,.04);
    --shadow-md: 0 4px 16px rgba(17,16,16,.10);
    --shadow-lg: 0 20px 48px rgba(17,16,16,.14);

    /* Transición */
    --ease: cubic-bezier(.16,1,.3,1);
    --dur:  280ms;
}

/* ====================================================
   RESET
==================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--chalk);
    color: var(--ink);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.1;
    letter-spacing: -.02em;
}

p { color: var(--dust); }
a { color: inherit; }

/* ====================================================
   APP SHELL
==================================================== */
.app-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====================================================
   CALC HEADER
==================================================== */
.calc-header {
    background: var(--ink);
    padding: 48px 20px 52px;
    position: relative;
    overflow: hidden;
}

.calc-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(250,250,248,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(250,250,248,.04) 1px, transparent 1px);
    background-size: 32px 32px;
}

.calc-header::after {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(217,119,6,.20) 0%, transparent 65%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: .85rem;
    font-weight: 500;
    color: rgba(250,250,248,.45);
    text-decoration: none;
    margin-bottom: var(--space-lg);
    transition: color var(--dur);
}

.back-link:hover { color: var(--clay); }

.calc-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    color: var(--chalk);
    margin-bottom: var(--space-sm);
}

.calc-header .subtitle {
    font-size: 1rem;
    color: rgba(250,250,248,.50);
    font-weight: 400;
}

/* ====================================================
   MAIN LAYOUT (2-col)
==================================================== */
.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: var(--space-lg);
    max-width: 1300px;
    margin: var(--space-lg) auto;
    padding: 0 var(--space-lg);
    flex: 1;
    width: 100%;
    align-items: start;
}

.sidebar,
.main-content {
    min-width: 0;
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        max-width: 100%;
        padding: 0 var(--space-md);
    }
}

/* ====================================================
   SIDEBAR
==================================================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    position: sticky;
    top: calc(64px + var(--space-md));
}

@media (max-width: 1024px) {
    .sidebar { position: static; }
}

/* ====================================================
   CARD (Sidebar sections)
==================================================== */
.card {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-sm);
    animation: fadeUp .3s var(--ease) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.card h2 {
    font-size: .72rem;
    font-weight: 600;
    color: var(--dust);
    text-transform: uppercase;
    letter-spacing: .10em;
    font-family: var(--font-body);
    padding: var(--space-md) 0 var(--space-md);
    border-bottom: 1px solid var(--mist);
    margin-bottom: var(--space-md);
}

/* ====================================================
   FORM ELEMENTS
==================================================== */
.input-group {
    margin-bottom: var(--space-md);
}

.input-group:last-child { margin-bottom: 0; }

.input-group label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--dust);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: var(--space-xs);
}

.form-select,
.form-input,
input[type="number"],
input[type="text"],
textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    background: var(--stone);
    border: 1px solid var(--mist);
    color: var(--ink);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: .95rem;
    font-weight: 500;
    transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
    outline: none;
    appearance: none;
}

.form-select:focus,
.form-input:focus,
input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: var(--clay);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(217,119,6,.15);
}

.input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-sm);
}

.input-row .input-group { margin-bottom: 0; }

/* ====================================================
   CHECKBOXES
==================================================== */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: .9rem;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    transition: background var(--dur);
}

.checkbox-item:hover { background: var(--stone); }

.checkbox-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--clay);
}

/* ====================================================
   INFO BOX
==================================================== */
.info-box {
    background: var(--clay-light);
    border-left: 3px solid var(--clay);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 10px 12px;
    margin-top: var(--space-md);
    font-size: .82rem;
    color: var(--clay-dark);
    line-height: 1.5;
    font-weight: 500;
}

.product-info {
    background: var(--stone);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
    border: 1px solid var(--mist);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--mist);
    font-size: .85rem;
}

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

.info-row .label {
    font-weight: 600;
    color: var(--dust);
}

.info-row .value {
    color: var(--clay);
    font-weight: 700;
}

/* ====================================================
   MAIN CONTENT
==================================================== */
.main-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ====================================================
   RESULT CARD
==================================================== */
.result-card {
    background: var(--ink);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    color: var(--chalk);
}

.result-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(250,250,248,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(250,250,248,.03) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.result-header {
    position: relative;
    z-index: 1;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(250,250,248,.08);
}

.result-header h2 {
    font-size: .72rem;
    font-weight: 600;
    color: var(--clay);
    letter-spacing: .12em;
    text-transform: uppercase;
    font-family: var(--font-body);
}

/* Stats grid */
.result-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(250,250,248,.06);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

@media (max-width: 600px) {
    .result-stats { grid-template-columns: 1fr; }
}

.stat-box {
    background: rgba(250,250,248,.04);
    padding: var(--space-md);
    text-align: center;
}

.stat-label {
    font-size: .72rem;
    color: rgba(250,250,248,.4);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.9rem;
    color: var(--chalk);
    line-height: 1;
    margin-bottom: 2px;
}

.stat-unit {
    font-size: .78rem;
    color: rgba(250,250,248,.35);
}

/* Main result highlight */
.result-main {
    position: relative;
    z-index: 1;
    background: var(--clay);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
}

.result-label {
    font-size: .72rem;
    letter-spacing: .12em;
    color: rgba(250,250,248,.7);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.result-number {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: 800;
    color: white;
    line-height: 1;
    letter-spacing: -.03em;
    margin-bottom: var(--space-sm);
}

.result-unit {
    font-size: .95rem;
    color: rgba(250,250,248,.75);
    font-weight: 500;
}

.calculation-detail {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(250,250,248,.2);
    font-size: .82rem;
    color: rgba(250,250,248,.65);
    line-height: 1.7;
}

/* Price rows */
.result-prices {
    position: relative;
    z-index: 1;
    background: rgba(250,250,248,.05);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid rgba(250,250,248,.07);
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid rgba(250,250,248,.06);
    font-size: .875rem;
    color: rgba(250,250,248,.7);
    font-weight: 500;
}

.price-row:last-child {
    border-bottom: none;
    color: var(--clay);
    font-size: 1rem;
    font-weight: 700;
    padding-top: var(--space-md);
}

/* Result footer note */
.result-footer {
    position: relative;
    z-index: 1;
    background: rgba(217,119,6,.12);
    border-left: 3px solid var(--clay);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 10px 14px;
    font-size: .82rem;
    color: rgba(250,250,248,.6);
    line-height: 1.5;
}

/* ====================================================
   STORES SECTION
==================================================== */
.stores-section,
.tips-section {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.stores-section h2,
.tips-section h2 {
    font-size: 1.25rem;
    color: var(--ink);
    margin-bottom: var(--space-xs);
}

.section-subtitle {
    color: var(--dust);
    font-size: .85rem;
    margin-bottom: var(--space-lg);
}

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--space-md);
}

.store-card {
    border: 1.5px solid var(--mist);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur) var(--ease);
    background: var(--chalk);
}

.store-card:hover {
    border-color: var(--clay);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.store-logo {
    font-family: var(--font-display);
    font-size: .85rem;
    color: var(--ink);
    letter-spacing: .04em;
}

.store-desc {
    font-size: .82rem;
    color: var(--dust);
    line-height: 1.4;
    flex: 1;
}

.store-badge {
    display: inline-block;
    background: var(--clay);
    color: white;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    width: fit-content;
}

/* ====================================================
   TIPS SECTION
==================================================== */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.tip-card {
    background: var(--chalk);
    border: 1px solid var(--mist);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    transition: box-shadow var(--dur), transform var(--dur) var(--ease);
}

.tip-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.tip-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    display: block;
}

.tip-card h3 {
    font-size: .95rem;
    color: var(--ink);
    margin-bottom: var(--space-xs);
    font-family: var(--font-body);
    font-weight: 700;
}

.tip-card p {
    font-size: .82rem;
    line-height: 1.55;
}

/* ====================================================
   AD SECTION
==================================================== */
.ad-section {
    border: 1px dashed var(--mist);
    border-radius: var(--radius-md);
}

.ad-placeholder {
    background: var(--stone);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-text {
    color: var(--mist);
    font-size: .85rem;
    font-style: italic;
}

/* ====================================================
   FOOTER
==================================================== */
.footer {
    background: #0D0D0D;
    color: var(--chalk);
    padding: 24px 20px;
    margin-top: auto;
    text-align: center;
    font-size: .82rem;
}

.footer p { color: rgba(250,250,248,.25); }

/* ====================================================
   BUTTONS
==================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 11px 22px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur);
    white-space: normal;
    text-align: center;
}

.btn-primary {
    background: var(--clay);
    color: white;
}

.btn-primary:hover {
    background: var(--clay-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(217,119,6,.3);
}

.btn-secondary {
    background: var(--white);
    border: 1.5px solid var(--mist);
    color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--clay);
    color: var(--clay);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--mist);
    color: var(--ink);
}

.btn-outline:hover {
    border-color: var(--clay);
    color: var(--clay);
}

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ====================================================
   RESPONSIVE
==================================================== */
@media (max-width: 768px) {
    .calc-header h1 { font-size: 1.7rem; }
    .result-number  { font-size: 3rem; }
    .stores-grid,
    .tips-grid      { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .card { padding: var(--space-md); }
    .result-card { padding: var(--space-md); }
    .input-row { grid-template-columns: minmax(0, 1fr); }
}

/* ====================================================
   PRINT
==================================================== */
@media print {
    .ad-section,
    .stores-section,
    .footer { display: none; }

    .main-layout {
        grid-template-columns: 1fr;
    }
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.result-actions .btn {
    flex: 1 1 220px;
    justify-content: center;
}
