/* =========================================================
   KLEEN - Clean Modern App Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-light: #ecfdf5;

    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-input: #f8fafc;
    
    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    
    --border: #e2e8f0;
    --border-active: #2563eb;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-full: 9999px;
}

/* Universal Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Mobile-First Centered Container */
.app-container {
    width: 100%;
    max-width: 440px;
    min-height: 100vh;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
    overflow-x: hidden;
}

/* App Header Bar */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    text-transform: uppercase;
}

.logo span {
    color: var(--primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.user-avatar:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

/* Main Form Area */
.app-main {
    flex: 1;
    padding: 20px 20px 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section Titles */
.booking-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-num {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 800;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.section-title h2 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =========================================================
   Step 1: Service Cards
   ========================================================= */
.services-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-card {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    user-select: none;
}

.service-card:hover {
    border-color: #cbd5e1;
}

.service-card.active {
    border-color: var(--primary);
    background-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.card-icon-box {
    font-size: 1.6rem;
    background: #ffffff;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.service-card.active .card-icon-box {
    border-color: var(--primary-border);
    background: #ffffff;
}

.card-info {
    flex: 1;
}

.card-info h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.card-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.card-price-badge .price {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.service-card.active .card-price-badge .price {
    color: var(--primary);
}

/* Accordion "Ver qué incluye" */
.btn-expand {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.btn-expand .chevron {
    transition: transform 0.2s ease;
    font-size: 0.85rem;
}

.btn-expand.open .chevron {
    transform: rotate(180deg);
}

.expanded-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.expanded-details.open {
    max-height: 280px;
}

.expanded-details ul {
    list-style: none;
    padding: 10px 0 2px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.expanded-details li {
    font-size: 0.8rem;
    color: var(--text-body);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.expanded-details li::before {
    content: '✓';
    color: var(--accent);
    font-weight: 800;
    font-size: 0.85rem;
}

/* =========================================================
   Step 2: Apartment Size Counters
   ========================================================= */
.counters-card {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 16px;
}

.counter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.counter-divider {
    height: 1px;
    background: var(--border);
}

.counter-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.row-icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-label h4 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}

.counter-label p {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.counter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-page);
    padding: 4px 6px;
    border-radius: var(--radius-full);
}

.btn-counter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.15s ease;
}

.btn-counter:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-counter:active {
    transform: scale(0.9);
}

.counter-value {
    font-size: 0.95rem;
    font-weight: 800;
    min-width: 16px;
    text-align: center;
    color: var(--text-main);
}

/* =========================================================
   Step 3: Extras (Add-ons)
   ========================================================= */
.addons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.addon-item {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.addon-item:hover {
    border-color: #cbd5e1;
}

.addon-checkbox {
    display: none;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    background: #ffffff;
}

.addon-checkbox:checked + .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.addon-checkbox:checked + .custom-checkbox::after {
    content: '✓';
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
}

.addon-item:has(.addon-checkbox:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.addon-icon-box {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.addon-info {
    flex: 1;
}

.addon-info h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
}

.addon-info p {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.addon-price {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
}

.addon-item:has(.addon-checkbox:checked) .addon-price {
    color: var(--primary);
}

/* =========================================================
   Step 4 & 5: Inputs
   =========================================================/* Inputs de Fecha y Dirección */
.datetime-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.address-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
}

.address-grid .full-width {
    grid-column: 1 / -1;
}

.field-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 2px;
}

.field-hint.error {
    color: #ef4444;
}

.field-hint.valid {
    color: var(--accent);
    font-weight: 600;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg-input);
    font-size: 0.88rem;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* =========================================================
   App Sticky Bottom Footer Bar (Always Fixed & Perfectly Aligned)
   ========================================================= */
.app-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
}

.summary-box {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.summary-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.btn-primary {
    flex: 1;
    max-width: 200px;
    padding: 13px 18px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-primary:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* =========================================================
   Modal Backdrop & Card
   ========================================================= */
.modal-backdrop {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 500px) {
    .modal-backdrop {
        align-items: center;
        padding: 20px;
    }
}

.modal-backdrop.open {
    display: flex !important;
}

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
}

@media (min-width: 500px) {
    .modal-card {
        border-radius: 20px;
    }
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

.btn-close-modal {
    background: var(--bg-page);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-receipt {
    background: var(--bg-page);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.84rem;
}

.receipt-row .r-label {
    color: var(--text-muted);
}

.receipt-row .r-value {
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
    max-width: 60%;
}

.receipt-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.receipt-row.receipt-total {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    padding-top: 4px;
}

.receipt-row.receipt-total .r-total-price {
    color: var(--primary);
    font-size: 1.1rem;
}

.method-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.method-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.method-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.method-card input {
    display: none;
}

.method-card.active,
.method-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.method-card .m-icon {
    font-size: 1.3rem;
}

.method-card .m-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn-confirm-pay {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Auth Modal Styling */
.auth-tabs {
    display: flex;
    background: var(--bg-page);
    padding: 4px;
    border-radius: var(--radius-sm);
    gap: 4px;
    margin-bottom: 6px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.auth-form-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

.full-btn {
    max-width: 100% !important;
    width: 100%;
    margin-top: 6px;
    padding: 14px;
}

.client-highlight {
    background: var(--primary-light);
    margin: -6px -6px 6px -6px;
    padding: 8px 10px !important;
    border-radius: var(--radius-sm);
}

.client-highlight .r-value {
    color: var(--primary) !important;
    font-weight: 700;
}

.user-avatar.logged-in {
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.85rem;
}

/* =========================================================
   Toast Notification (Hidden by default)
   ========================================================= */
.toast {
    display: none !important;
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 0.86rem;
    font-weight: 600;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.toast.show {
    display: flex !important;
    animation: toastPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastPop {
    from {
        opacity: 0;
        transform: translate(-50%, -15px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
