/* ========================================
   PRESUPUESTO V2 - PREMIUM DESIGN SYSTEM
   Strict Consistency & Global Rules
   ======================================== */

:root {
    /* 1. Palette Consistency */
    --color-primary: #111111;
    /* Text Main */
    --color-secondary: #64748B;
    /* Text Secondary (Gray Medium) */
    --color-tertiary: #94A3B8;
    /* Text Micro / Placeholder */

    --brand-green: #2D6A4F;
    /* Links / Active / Primary Actions */
    --brand-green-dark: #1B4332;
    --brand-green-light: #D1FAE5;
    /* Backgrounds / Chips */

    --bg-page: #F8FAFC;
    /* Light Gray Page BG */
    --bg-card: #FFFFFF;

    --border-color: #E2E8F0;
    --focus-ring: rgba(45, 106, 79, 0.25);
    --error: #EF4444;

    --red-brand: #E63946;
    --red-dark: #C92A35;

    /* 2. Typography Scale (Strict) */
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --text-h1: 1.75rem;
    /* ~28px */
    --lh-h1: 1.15;
    --weight-h1: 700;

    --text-h2: 1.25rem;
    /* ~20px */
    --lh-h2: 1.2;
    --weight-h2: 700;

    --text-body: 1rem;
    /* 16px */
    --lh-body: 1.45;
    --weight-body: 500;

    --text-sub: 0.875rem;
    /* 14px */
    --text-label: 0.75rem;
    /* 12px (Premium Small Label) */
    --weight-label: 600;

    --text-micro: 0.75rem;
    /* 12px */

    /* 3. Spacing System (8pt) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-xxl: 32px;

    /* 4. Component Tokens */
    --radius-card: 16px;
    /* Consistent Card Radius */
    --radius-input: 8px;
    --radius-pill: 9999px;

    --input-height: 56px;
    /* Taller Premium Inputs */
    --btn-height: 56px;

    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-stack);
    background: var(--bg-page);
    color: var(--color-primary);
    line-height: var(--lh-body);
    font-weight: var(--weight-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 100px;
    /* Safe space for sticky footer */
}

/* ========================================
   GLOBAL COMPONENT: HEADER
   ======================================== */
.form-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    /* 12px 24px */
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.back-link {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    border-radius: 50%;
    color: var(--color-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.back-link:hover {
    color: var(--color-primary);
    background: var(--border-color);
}

.header-title h1 {
    font-size: var(--text-h2);
    /* 20px */
    font-weight: 700;
    /* Strict matching weight */
    line-height: var(--lh-h2);
    color: var(--color-primary);
    letter-spacing: -0.01em;
}

.header-title p {
    font-size: var(--text-micro);
    color: var(--color-secondary);
    opacity: 0.8;
}

/* ========================================
   GLOBAL COMPONENT: STEPPER
   ======================================== */
.progress-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-xl) var(--space-lg);
}

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 0 0 auto;
}

.step-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--color-tertiary);
    /* Inactive text */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-micro);
    font-weight: 700;
    transition: all 0.3s;
}

/* Active Styling */
.progress-step.active .step-circle {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: var(--bg-card);
    box-shadow: 0 0 0 4px var(--brand-green-light);
}

/* Completed Styling */
.progress-step.completed .step-circle {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: var(--bg-card);
}

/* Label Visibility Logic */
.step-label {
    display: none;
    /* Hidden by default on mobile */
}

/* Active Label Visible on Mobile */
.progress-step.active .step-label {
    display: block;
    color: var(--brand-green);
    font-weight: 700;
    font-size: var(--text-label);
    /* 12px */
    margin-left: 6px;
    animation: fadeIn 0.3s;
}

/* Desktop: Always visible */
@media (min-width: 640px) {
    .step-label {
        display: block;
        font-size: var(--text-label);
        color: var(--color-tertiary);
        margin-left: 6px;
    }

    .progress-step.active .step-label {
        color: var(--brand-green);
    }
}

/* Line */
.progress-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
    margin: 0 var(--space-sm);
}

/* ========================================
   GLOBAL COMPONENT: LAYOUT & CARDS
   ======================================== */
.form-main {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    padding: var(--space-xl);
    /* 24px */
}

.step-content {
    display: none;
    animation: fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-content.active {
    display: block;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-inner {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.02);
    padding: var(--space-xl);
    /* 24px */
}

/* Section Typography */
.step-header {
    margin-bottom: var(--space-xl);
}

.step-header h2 {
    font-size: var(--text-h1);
    /* 28px */
    font-weight: 700;
    /* Strict matching weight */
    line-height: var(--lh-h1);
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.step-header p {
    font-size: var(--text-body);
    color: var(--color-secondary);
}

/* ========================================
   GLOBAL COMPONENT: FORMS
   ======================================== */
.form-group {
    margin-bottom: var(--space-xl);
    /* 24px consistent spacing */
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    /* 8px */
    font-size: var(--text-label);
    /* 12px Premium Small */
    font-weight: var(--weight-label);
    color: var(--color-primary);
    text-transform: uppercase;
    /* Optional touch for 'Apple' vibe? Or just clean? Keeping normal case but small */
    letter-spacing: 0.02em;
}

.required {
    color: var(--error);
    margin-left: 2px;
}

.optional {
    color: var(--color-secondary);
    font-weight: 400;
}

.form-input,
.form-textarea,
.select-wrapper select {
    width: 100%;
    height: var(--input-height);
    /* 56px Taller */
    padding: 0 var(--space-lg);
    /* 16px */
    font-size: var(--text-body);
    font-family: var(--font-stack);
    color: var(--color-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-input);
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.form-textarea {
    height: auto;
    padding: var(--space-md) var(--space-lg);
    line-height: 1.5;
}

.form-input:focus,
.form-textarea:focus,
.select-wrapper select:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.form-input::placeholder {
    color: var(--color-tertiary);
    opacity: 0.6;
    /* Lighter placeholder as requested */
}

/* Fix Autofill Blue Background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--color-primary) !important;
}

/* Select Chevron */
.select-wrapper {
    position: relative;
}

.select-icon {
    position: absolute;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-secondary);
    pointer-events: none;
    font-size: 0.875rem;
}

/* ========================================
   GLOBAL COMPONENT: BADGE (iOS Style)
   ======================================== */
.global-service-badge {
    background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-float);
    color: var(--bg-card);
}

.badge-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

/* Icon Container */
.badge-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.badge-icon i {
    font-size: 1.25rem;
    color: var(--bg-card);
}

.badge-info {
    flex: 1;
    overflow: hidden;
}

/* Chip Style: Subtle & Small */
.preselected-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(209, 250, 229, 0.25);
    /* Mint Green, but Glassy/Subtle */
    color: var(--brand-green-light);
    /* Lighter text for contrast on dark bg */
    border: 1px solid rgba(209, 250, 229, 0.3);
    padding: 2px 8px;
    /* Smaller padding */
    border-radius: 20px;
    font-size: 11px;
    /* Smaller Font */
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
}

.preselected-chip i {
    font-size: 9px;
}

/* Badge Text */
.badge-label {
    display: block;
    font-size: var(--text-micro);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2px;
}

.badge-value {
    display: block;
    font-size: 1.125rem;
    /* 18px Bold Protagonist */
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

/* Change Button (Pill) - True Secondary */
.badge-change-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.badge-change-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--white);
}

/* ========================================
   GLOBAL COMPONENT: SELECTION TILES
   ======================================== */
.service-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.service-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    transition: all 0.2s;
}

.service-tile:hover {
    border-color: var(--brand-green);
    background: var(--bg-page);
}

.service-tile.selected {
    border-color: var(--brand-green);
    background: var(--brand-green);
    color: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.service-tile i {
    font-size: 1.75rem;
    color: var(--brand-green);
}

.service-tile.selected i {
    color: var(--bg-card);
}

.service-tile span {
    font-size: var(--text-sub);
    font-weight: 600;
}

/* Sub-service List */
.subservice-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.subservice-item {
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-input);
    font-size: var(--text-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.subservice-item:hover {
    border-color: var(--brand-green);
    background: var(--bg-page);
}

.subservice-item.selected {
    border-color: var(--brand-green);
    background: var(--brand-green-light);
    color: var(--brand-green-dark);
    font-weight: 700;
}

/* Date Options */
.date-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.date-option {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: var(--text-sub);
    font-weight: 600;
    color: var(--color-primary);
}

.date-option:hover {
    border-color: var(--brand-green);
    background: var(--bg-page);
}

.date-option.selected {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.date-option i {
    font-size: 1.125rem;
}

/* ========================================
   GLOBAL COMPONENT: STICKY FOOTER
   ======================================== */
.form-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    padding: var(--space-lg) var(--space-xl) 32px;
    /* Extra bottom padding */
    z-index: 99;
    display: flex;
    justify-content: center;
}

.footer-content {
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.btn-back {
    background: none;
    border: none;
    color: var(--color-secondary);
    font-weight: 600;
    font-size: var(--text-sub);
    cursor: pointer;
    padding: 0 var(--space-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-back:hover {
    color: var(--color-primary);
}

.btn-primary {
    flex: 1;
    width: 100%;
    height: 56px;
    /* Taller for touch */
    background: var(--color-primary);
    color: var(--bg-card);
    border: none;
    border-radius: var(--radius-pill);
    font-size: 1.0625rem;
    /* ~17px */
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: var(--color-tertiary);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.hidden {
    display: none !important;
}

/* Summary Confirmation */
.summary-card {
    background: var(--bg-page);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-row:last-child {
    border: none;
}

.s-label {
    color: var(--color-secondary);
    font-size: var(--text-sub);
}

.s-val {
    color: var(--color-primary);
    font-weight: 600;
    font-size: var(--text-body);
    text-align: right;
}

/* ========================================
   GLOBAL COMPONENT: MODAL (Premium)
   ======================================== */
.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: var(--space-xl);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-float);
    animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
    from {
        transform: scale(0.9);
    }

    to {
        transform: scale(1);
    }
}

.success-icon {
    font-size: 48px;
    color: var(--brand-green);
    margin-bottom: var(--space-lg);
}

.modal-content h2 {
    font-size: var(--text-h1);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--color-primary);
    line-height: var(--lh-h1);
}

.modal-content p {
    font-size: var(--text-body);
    color: var(--color-secondary);
    margin-bottom: var(--space-sm);
}

.contact-info {
    font-size: var(--text-sub) !important;
    background: var(--bg-page);
    padding: var(--space-md);
    border-radius: var(--radius-input);
    margin: var(--space-md) 0;
    color: var(--color-primary) !important;
    display: block;
}

.microcopy {
    font-size: var(--text-micro);
    color: var(--color-tertiary);
    margin-bottom: var(--space-xl);
}

.btn-close-modal {
    width: 100%;
    height: 56px;
    background: var(--color-primary);
    color: var(--bg-card);
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 600;
    cursor: pointer;
    font-size: var(--text-body);
    transition: transform 0.2s;
}

.btn-close-modal:active {
    transform: scale(0.98);
}

/* ========================================
   COMPONENT: SERVICE SUMMARY (Pre-selected)
   ======================================== */
.service-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-card);
    animation: fadeIn 0.4s ease;
}

.summary-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-info {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: var(--text-label);
    color: var(--color-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-primary);
}

.btn-change {
    background: var(--red-brand);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: var(--text-sub);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(230, 57, 70, 0.3);
    transition: all 0.2s;
}

.btn-change:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(230, 57, 70, 0.4);
}

.btn-change:active {
    transform: scale(0.96);
}

/* ========================================
   TRUST BADGE (SECURITY)
   ======================================== */
.trust-badge {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: rgba(45, 106, 79, 0.05);
    /* Brand Green subtle tint */
    border: 1px solid rgba(45, 106, 79, 0.1);
    border-radius: var(--radius-card);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.trust-badge i {
    font-size: 24px;
    color: var(--brand-green);
    flex-shrink: 0;
}

.trust-badge div {
    display: flex;
    flex-direction: column;
}

.trust-badge strong {
    font-size: var(--text-sub);
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 2px;
}

.trust-badge p {
    font-size: var(--text-micro);
    color: var(--color-secondary);
    margin: 0;
    line-height: 1.4;
}

/* ========================================
   VALIDATION HELPERS
   ======================================== */
.form-input.valid {
    border-color: var(--brand-green);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="%232D6A4F" d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.form-input.invalid {
    border-color: var(--error);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="%23EF4444" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

/* Shake animation for invalid submit */
.shake-animation {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}