/* ═══════════════════════════════════════════════════
   Carnelio Demo — Design System
   Mobile-first, matches app/cierres and app/costeo style
   ═══════════════════════════════════════════════════ */

/* ─── Variables ────────────────────────────────── */
:root {
    --primary: #C8102E;
    --primary-dark: #A00C24;
    --secondary: #FF5722;
    --success: #4CAF50;
    --info: #2980B9;
    --dark: #212121;
    --bg: #F5F5F5;
    --surface: #FFFFFF;
    --text-muted: #888;

    /* Brand payment colors */
    --brand-nequi: #9B59B6;
    --brand-davi: #E74C3C;
    --brand-card: #2980B9;

    /* WhatsApp */
    --wa-green: #25D366;
    --wa-bg: #ECE5DD;
    --wa-bubble-out: #DCF8C6;
    --wa-bubble-in: #FFFFFF;
    --wa-header: #075E54;
}

/* ─── Base Reset ───────────────────────────────── */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg);
    color: var(--dark);
    margin: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    min-height: 100vh;
    min-height: 100dvh;
    user-select: none;
    touch-action: manipulation;
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

/* ─── Typography ───────────────────────────────── */
.font-montserrat {
    font-family: 'Montserrat', sans-serif;
}

.font-roboto {
    font-family: 'Roboto', sans-serif;
}

/* ─── Scrollbar Hide ───────────────────────────── */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ─── Carnelio Bubble (Non-blocking bottom sheet) ─ */
.carnelio-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    display: flex;
    justify-content: center;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0;
    transform: translateY(100%);
}

.carnelio-overlay.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Contextual position — near the highlighted element */
.carnelio-overlay.position-contextual {
    bottom: auto;
    top: 0;
    transform: translateY(20px);
    opacity: 0;
    padding: 12px;
    transition: opacity 0.3s ease, top 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.3s ease;
}

.carnelio-overlay.position-contextual.active {
    opacity: 1;
    transform: translateY(0);
}

/* Center position — vertically centered in viewport */
.carnelio-overlay.position-center {
    bottom: auto;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    transform: scale(0.92);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.carnelio-overlay.position-center.active {
    opacity: 1;
    transform: scale(1);
}

.carnelio-bubble {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15), 0 8px 30px rgba(0, 0, 0, 0.1);
    padding: 0;
    max-width: 400px;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.carnelio-bubble-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 10px;
}

.carnelio-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: contain;
    background: #FFF5F5;
    border: 2px solid #FECDD3;
    flex-shrink: 0;
}

.carnelio-text {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--dark);
    flex: 1;
}

.carnelio-text strong {
    color: var(--primary);
    font-weight: 700;
}

.carnelio-bubble-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px;
    justify-content: flex-end;
}

.carnelio-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.carnelio-btn:active {
    transform: scale(0.95);
}

.carnelio-btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.35);
}

.carnelio-btn-primary:active {
    background: var(--primary-dark);
}

.carnelio-btn-secondary {
    background: #F5F5F5;
    color: #666;
    border: 1px solid #E0E0E0;
}

.carnelio-btn-secondary:active {
    background: #E8E8E8;
}

/* Reserve space at bottom for the bubble so content isn't hidden */
.carnelio-spacer {
    height: 140px;
    flex-shrink: 0;
}

/* ─── Spotlight Overlay ───────────────────────── */
/* Soft overlay that dims the page to draw focus */
.carnelio-spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 8500;
    background: rgba(0, 0, 0, 0.12);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.carnelio-spotlight-overlay.active {
    opacity: 1;
}

/* The highlighted element rises above the overlay */
.carnelio-highlight {
    position: relative;
    z-index: 8600;
    border-radius: inherit;
    box-shadow: 0 0 0 4px rgba(200, 16, 46, 0.25), 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    animation: spotlightPulse 2s infinite ease-in-out;
    pointer-events: auto;
    cursor: pointer;
}

/* Number counting animation */
@keyframes countPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
        color: var(--info);
    }

    100% {
        transform: scale(1);
    }
}

.hero-amount-bump {
    animation: countPulse 0.25s ease-out;
}

@keyframes spotlightPulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(200, 16, 46, 0.2), 0 4px 20px rgba(0, 0, 0, 0.12);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(200, 16, 46, 0.35), 0 6px 30px rgba(0, 0, 0, 0.18);
    }
}

/* ─── Transaction entrance animation ──────────── */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tx-item-enter {
    animation: fadeSlideIn 0.35s ease-out forwards;
}

/* ─── Expandable hero rows (post-sim) ─────────── */
.hero-row-expandable {
    cursor: pointer;
    transition: background 0.2s ease;
}

.hero-row-expandable:active {
    background: rgba(0, 0, 0, 0.03);
}

.hero-row-expandable::after {
    content: '▸';
    font-size: 12px;
    color: #bbb;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.hero-row-expandable.expanded::after {
    transform: rotate(90deg);
}

.hero-row-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 0 12px 12px;
    font-size: 12px;
}

.hero-row-details.open {
    max-height: 400px;
    padding: 8px 12px;
}

.hero-row-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: #666;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.hero-row-detail-item:last-child {
    border-bottom: none;
}

/* ─── Simulated Clock Bar ──────────────────────── */
.sim-clock-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    gap: 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 12px rgba(200, 16, 46, 0.3);
}

.sim-clock-time {
    font-size: 18px;
    font-weight: 800;
    min-width: 70px;
    text-align: center;
    letter-spacing: 1px;
}

.sim-clock-progress {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    max-width: 200px;
}

.sim-clock-fill {
    height: 100%;
    background: white;
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

/* ─── Hero Card (Cierres style) ────────────────── */
.hero-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(to right, var(--primary), #FF5722);
    border-radius: 16px 16px 0 0;
}

.hero-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 6px;
}

.hero-row:last-child {
    margin-bottom: 0;
}

.hero-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-label i {
    font-size: 13px;
    opacity: 0.7;
}

.hero-label span {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-amount {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 18px;
    text-align: right;
    margin-left: auto;
}

/* Persistent explanatory labels during simulation */
.sim-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(200, 16, 46, 0.06);
    border: 1px solid rgba(200, 16, 46, 0.12);
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    animation: fadeSlideIn 0.5s ease-out forwards;
    opacity: 0;
}

.sim-label i {
    color: var(--primary);
    font-size: 14px;
}

/* Row color themes */
.hero-row-green {
    background: rgba(76, 175, 80, 0.06);
    border: 1px solid rgba(76, 175, 80, 0.15);
}

.hero-row-green .hero-label i,
.hero-row-green .hero-label span {
    color: var(--success);
}

.hero-row-green .hero-amount {
    color: var(--dark);
}

.hero-row-red {
    background: rgba(200, 16, 46, 0.04);
    border: 1px solid rgba(200, 16, 46, 0.12);
}

.hero-row-red .hero-label i,
.hero-row-red .hero-label span {
    color: var(--primary);
}

.hero-row-red .hero-amount {
    color: var(--primary);
}

.hero-row-orange {
    background: rgba(255, 87, 34, 0.04);
    border: 1px solid rgba(255, 87, 34, 0.12);
}

.hero-row-orange .hero-label i,
.hero-row-orange .hero-label span {
    color: var(--secondary);
}

.hero-row-orange .hero-amount {
    color: var(--secondary);
}

.hero-row-blue {
    background: rgba(41, 128, 185, 0.06);
    border: 1px solid rgba(41, 128, 185, 0.15);
}

.hero-row-blue .hero-label i,
.hero-row-blue .hero-label span {
    color: var(--info);
}

.hero-row-blue .hero-amount {
    color: var(--info);
    font-size: 20px;
}

/* ─── Transaction Feed ─────────────────────────── */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid #F0F0F0;
    animation: txSlideIn 0.3s ease-out;
}

.tx-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-right: 10px;
    flex-shrink: 0;
}

.tx-icon-income {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
}

.tx-icon-expense {
    background: rgba(255, 87, 34, 0.1);
    color: var(--secondary);
}

.tx-icon-withdrawal {
    background: rgba(200, 16, 46, 0.1);
    color: var(--primary);
}

.tx-detail {
    flex: 1;
    min-width: 0;
}

.tx-detail-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-detail-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.tx-amount {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    margin-left: 8px;
}

.tx-amount-income {
    color: var(--success);
}

.tx-amount-expense {
    color: var(--primary);
}

.tx-amount-withdrawal {
    color: var(--secondary);
}

@keyframes txSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── WhatsApp Chat Simulation ─────────────────── */
.wa-container {
    background: var(--wa-bg);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.wa-header {
    background: var(--wa-header);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.wa-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #128C7E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.wa-contact-name {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
}

.wa-contact-status {
    font-size: 12px;
    opacity: 0.8;
}

.wa-messages {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.wa-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: waMsgIn 0.3s ease-out;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.wa-msg-out {
    background: var(--wa-bubble-out);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.wa-msg-in {
    background: var(--wa-bubble-in);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.wa-msg-highlight {
    border: 2px solid var(--wa-green);
    box-shadow: 0 0 8px rgba(37, 211, 102, 0.3);
}

.wa-msg-time {
    font-size: 10px;
    color: #999;
    text-align: right;
    margin-top: 3px;
}

.wa-divider {
    text-align: center;
    padding: 8px 0;
}

.wa-divider span {
    background: #E1F3FB;
    color: #5B8FB9;
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 500;
}

@keyframes waMsgIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Costeo Module ────────────────────────────── */
.costeo-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    padding: 12px 15px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.costeo-product-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.costeo-product-card.highlighted {
    border-color: var(--secondary);
    box-shadow: 0 6px 20px rgba(255, 87, 34, 0.2);
    animation: cardPulse 1.5s infinite ease-in-out;
}

.costeo-input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 22px;
    font-weight: 500;
    height: 50px;
    outline: none;
    width: 100%;
    background: var(--surface);
    caret-color: var(--primary);
}

.costeo-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

@keyframes cardPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(255, 87, 34, 0.2);
    }

    50% {
        transform: scale(1.01);
        box-shadow: 0 8px 25px rgba(255, 87, 34, 0.35);
    }
}

/* ─── CTA / Closing ────────────────────────────── */
.cta-card {
    background: linear-gradient(135deg, #C8102E, #FF5722);
    border-radius: 20px;
    padding: 28px 24px;
    color: white;
    text-align: center;
    box-shadow: 0 8px 30px rgba(200, 16, 46, 0.3);
}

.cta-btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--wa-green);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px 28px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.15s ease;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    text-decoration: none;
    animation: ctaPulse 2s infinite ease-in-out;
}

.cta-btn-whatsapp:active {
    transform: scale(0.96);
}

@keyframes ctaPulse {

    0%,
    100% {
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    }

    50% {
        box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6);
    }
}

/* ─── Check List (CTA summary) ─────────────────── */
.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid #F0F0F0;
    margin-bottom: 6px;
    animation: checkIn 0.4s ease-out backwards;
}

.check-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.check-text {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: var(--dark);
    line-height: 1.3;
}

@keyframes checkIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── Modal Overlay ────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

/* ─── General Buttons ──────────────────────────── */
.btn-red {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.35);
    transition: all 0.15s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-red:active {
    background: var(--primary-dark);
    transform: scale(0.97);
}

.btn-outline {
    background: transparent;
    color: var(--dark);
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    padding: 12px 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-outline:active {
    background: #F5F5F5;
    transform: scale(0.97);
}

/* ─── Utility ──────────────────────────────────── */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.px-4 {
    padding-left: 16px;
    padding-right: 16px;
}

.py-6 {
    padding-top: 24px;
    padding-bottom: 24px;
}

.gap-3 {
    gap: 12px;
}

.hidden {
    display: none !important;
}