/* ==========================================================================
   CYSPAY APP - FRONTEND STYLES (ALTA CLARIDAD VISUAL & MOBILE FIRST)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta de la Marca (Logo) */
    --brand-black: #111111; 
    --brand-blue: #004BFE;  
    
    /* Fondos y Textos de Alto Contraste */
    --white: #FFFFFF;
    --bg-app: #E2E8F0;      /* Fondo exterior un poco más oscuro para resaltar la tarjeta */
    --bg-input: #F8FAFC;    /* Gris muy claro para inputs, contrasta con el blanco de la tarjeta */
    --text-main: #0F172A;   /* Texto casi negro para máxima legibilidad */
    --text-muted: #475569;  /* Gris oscuro para etiquetas */
    
    /* Bordes y Alertas */
    --border-color: #CBD5E1; /* Borde más definido y visible */
    --status-error: #ef4444;   
    --status-info: #3b82f6;    
    --status-success: #10b981; 
    --status-disabled: #94a3b8;
    --whatsapp-green: #25D366;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center; 
    min-height: 100vh;
}

/* ==========================================
   TARJETA PRINCIPAL (CON MAYOR RELIEVE)
   ========================================== */
.calculator-card {
    background: var(--white);
    width: 100%;
    max-width: 450px;
    min-height: 100vh; 
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); /* Sombra base en móvil */
}

@media (min-width: 480px) {
    body { padding: 20px; }
    .calculator-card {
        min-height: 680px;
        height: auto;
        border-radius: 24px;
        box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); /* Sombra pesada en PC para resaltar */
    }
}

/* ==========================================
   WIZARD (PASOS Y NAVEGACIÓN)
   ========================================== */
.form-step {
    display: none;
    opacity: 0;
    flex-direction: column;
    flex: 1;
    padding: 25px 24px 30px; 
}

.form-step.active {
    display: flex; 
    animation: slideInNative 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideInNative {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

.hidden { display: none !important; }

/* Barra de Progreso */
.progress-container {
    width: 100%;
    background-color: #E2E8F0;
    height: 5px;
}
.progress-bar {
    height: 100%;
    background-color: var(--brand-blue);
    width: 25%;
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 2px 4px rgba(0, 75, 254, 0.3);
}

/* Cabeceras de Paso */
.step-icon-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0 20px;
}
.step-icon-container svg {
    width: 55px;
    height: 55px;
    fill: var(--brand-blue);
    background-color: #EFF6FF; 
    padding: 12px;
    border-radius: 16px; 
    border: 2px solid #DBEAFE;
}

.step-title {
    color: var(--brand-black);
    margin: 0 0 25px 0;
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.5px;
}

/* ==========================================
   INPUTS Y SELECTORES (CLAROS Y PROFUNDOS)
   ========================================== */
.input-group {
    margin-bottom: 10px;
}

.label-main, .input-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cajas de texto inconfundibles */
.input-wrapper, .custom-select {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 2px solid var(--border-color); /* Borde de 2px para que se note mucho más */
    border-radius: 14px;
    min-height: 56px;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); /* Sombra interior (hueco) */
}

.input-wrapper { padding: 4px 16px; }

/* Foco Nativo (Al hacer clic brilla fuerte) */
.input-wrapper:focus-within, .custom-select:hover, .custom-select.active {
    border-color: var(--brand-blue);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(0, 75, 254, 0.15), inset 0 0 0 transparent; /* Cambia a brillo exterior */
}

.input-wrapper input {
    border: none;
    background: transparent;
    font-size: 1.15rem;
    font-weight: 700;
    width: 100%;
    outline: none;
    color: var(--brand-black);
    padding: 10px 0;
}

.currency-tag {
    font-weight: 800;
    color: var(--brand-blue); /* Moneda en azul para destacar */
    margin-left: 10px;
    background: #EFF6FF;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.field-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.2;
}

/* SELECTORES DINÁMICOS */
.custom-select {
    position: relative;
    margin-bottom: 10px;
    cursor: pointer;
}

.select-selected {
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--brand-black);
    width: 100%;
}

.select-selected img, .select-items div img {
    width: 28px;
    height: 28px;
    border-radius: 50%; 
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Flecha robusta */
.select-selected::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 12px;
    height: 12px;
    border-right: 3px solid var(--text-muted);
    border-bottom: 3px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.3s;
}

.custom-select.active .select-selected::after {
    transform: translateY(-20%) rotate(225deg);
    border-color: var(--brand-blue);
}

/* Menú Desplegable flotante */
.select-items {
    position: absolute;
    background-color: var(--white);
    bottom: 110%; 
    left: 0;
    right: 0;
    z-index: 999;
    border: 2px solid var(--brand-blue); /* Borde azul para notar que está activo */
    border-radius: 16px;
    box-shadow: 0 -10px 30px rgba(0,75,254,0.15);
    max-height: 220px; 
    overflow-y: auto; 
    padding: 8px;
}

#select-origin .select-items, 
#select-destination .select-items {
    bottom: auto;
    top: 110%; 
    box-shadow: 0 10px 30px rgba(0,75,254,0.15);
}

.select-items div {
    padding: 12px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
    border-radius: 10px;
    font-weight: 600;
}

.select-items div:hover {
    background-color: #EFF6FF;
    color: var(--brand-blue);
}

.select-hide { display: none; }

/* ==========================================
   BANNERS (INFO CLARA)
   ========================================== */
.rate-banner, .promo-banner {
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 22px;
    line-height: 1.5;
}

.rate-banner {
    background-color: #EFF6FF;
    border-left: 5px solid var(--brand-blue);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
}

.promo-banner {
    background-color: #ECFDF5;
    border-left: 5px solid var(--status-success);
    color: #065F46;
    font-size: 0.85rem;
}

.fee-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: -5px 0 20px;
    padding: 0 5px;
    font-weight: 600;
}

.fee-value { font-weight: 800; color: var(--status-error); }

.form-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

/* ==========================================
   NUEVO RESUMEN FINAL (GRID CARD LAYOUT)
   ========================================== */
.summary-box {
    background-color: transparent;
    border: none;
    padding: 0;
    margin-bottom: 22px;
}

.cyspay-summary-container {
    background-color: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    font-family: inherit;
}

.summary-block {
    margin-bottom: 15px;
}

.block-title {
    margin: 0 0 15px 0; 
    font-size: 0.85rem;
    color: var(--brand-black);
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-weight: 800;
}

.title-receiver { color: var(--brand-blue); }

.summary-item {
    display: grid;
    grid-template-columns: 75px 1fr;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.summary-label {
    font-size: 0.85rem; 
    color: var(--text-muted);
    font-weight: 600;
}

.summary-value {
    font-size: 0.95rem; 
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word; /* Evita que correos largos rompan la tarjeta */
}

.inline-group {
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-top: 12px;
    background: rgba(0,0,0,0.03); /* Leve sombreado para agrupar método/país */
    padding: 10px;
    border-radius: 8px;
}

.item-half { 
    grid-template-columns: 50px 1fr; 
    flex: 1; 
    min-width: 120px; 
    margin-bottom: 0; 
}

.separator-dashed {
    border: 0; 
    border-top: 2px dashed var(--border-color); 
    margin: 20px 0;
}

.block-amounts {
    margin-top: 20px; 
    background-color: var(--white);
    border-radius: 12px; 
    padding: 15px; 
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.amount-item {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 8px 0;
}

.amount-item + .amount-item { 
    border-top: 1px solid var(--border-color); 
    padding-top: 12px; 
    margin-top: 4px;
}

.amount-group {
    display: flex; 
    align-items: baseline; 
    gap: 5px; 
    text-align: right;
}

.amount-value-large {
    font-size: 1.4rem; 
    font-weight: 800; 
    color: var(--text-main);
}

.amount-currency-small {
    font-size: 0.85rem; 
    font-weight: 800; 
    color: var(--brand-blue);
}

/* Área destacada del monto a recibir */
.highlight-amount { 
    background-color: #ECFDF5; 
    margin: 10px -15px -15px -15px; /* Expande al borde del contenedor */
    padding: 15px;
    border-radius: 0 0 10px 10px;
    border-top: 2px dashed #A7F3D0 !important;
}
.highlight-amount .summary-label { color: #065F46; font-weight: 700; }
.highlight-amount .amount-value-large { color: #065F46; font-size: 1.6rem; }
.highlight-amount .amount-currency-small { color: #059669; }

/* ==========================================
   BOTONES GLOBALES Y DEL WIZARD (3D)
   ========================================== */

/* Estilo base para TODOS los botones */
.btn-primary, .btn-secondary, .btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 58px; 
    width: 100%;  
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 800; 
    border-radius: 16px; 
    cursor: pointer;
    /* TRANSICIÓN MAESTRA: 0.6s para el hover (brillo/color), 0.1s para el clic (transform/sombra) */
    transition: filter 0.6s ease, background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease, transform 0.1s ease, box-shadow 0.1s ease;
    border: none;
    outline: none;
    margin-top: 15px; 
}

/* Efecto Físico de Botón (Hundimiento rápido al hacer click) */
.btn-primary:active, .btn-secondary:active, .btn-whatsapp:active { 
    transform: translateY(3px); 
    box-shadow: none !important; 
}

/* Colores y Sombras 3D Individuales */
.btn-primary { 
    background: linear-gradient(180deg, #222222 0%, var(--brand-black) 100%); 
    box-shadow: 0 6px 0 #000000, 0 10px 20px rgba(0,0,0,0.2); 
    border: 1px solid #333;
    color: var(--white);
}
/* Usamos filter: brightness para iluminar el gradiente suavemente sin romper la animación */
.btn-primary:hover { filter: brightness(1.25); }

.btn-whatsapp { 
    background: linear-gradient(180deg, #25D366 0%, #1DA851 100%); 
    box-shadow: 0 6px 0 #14833E, 0 10px 20px rgba(37,211,102,0.3); 
    color: var(--white);
}
.btn-whatsapp:hover { filter: brightness(1.15); }

.btn-secondary {
    background-color: var(--white);
    color: var(--text-muted);
    border: 2px solid var(--border-color) !important;
    box-shadow: 0 4px 0 var(--border-color); 
}
.btn-secondary:hover { 
    color: var(--brand-black);
    border-color: #94A3B8 !important;
    box-shadow: 0 4px 0 #94A3B8;
    background-color: #F8FAFC; /* Fondo muy sutil al pasar el mouse */
}

/* Iconos dentro de los botones */
.btn-primary svg, .btn-secondary svg, .btn-whatsapp svg {
    width: 24px !important; 
    height: 24px !important;
    fill: currentColor;
}

/* -------------------------------------------
   COMPORTAMIENTO CUANDO ESTÁN EN GRUPO (Wizard)
   ------------------------------------------- */
.button-group {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: auto; 
    padding-top: 20px;
}

.button-group .btn-secondary { flex: 1; margin-top: 0; }
.button-group .btn-primary, .button-group .btn-whatsapp { flex: 2; margin-top: 0; }

/* ==========================================
   CHECKBOX DE TÉRMINOS
   ========================================== */
.terms-container { margin: 10px 0 20px; }
.checkbox-wrapper { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; position: relative; user-select: none; }
.checkbox-wrapper input { position: absolute; opacity: 0; height: 0; width: 0; }

.checkmark {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background-color: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.checkbox-wrapper input:checked ~ .checkmark {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    box-shadow: none;
}

.checkmark:after {
    content: "";
    display: none;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}
.checkbox-wrapper input:checked ~ .checkmark:after { display: block; }
.terms-text { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; font-weight: 500;}
.terms-text a { color: var(--brand-blue); text-decoration: none; font-weight: 700; }

/* ==========================================
   VALIDACIONES (ERROR STATES)
   ========================================== */
.input-error {
    border-color: var(--status-error) !important;
    background-color: #FEF2F2 !important;
    box-shadow: inset 0 0 0 1px var(--status-error), 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
    animation: shake 0.4s ease-in-out;
}
.input-error input::placeholder { color: var(--status-error); opacity: 0.8; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.btn-disabled {
    background: #E2E8F0 !important;
    color: #94A3B8 !important;
    border: 2px solid #CBD5E1 !important;
    box-shadow: 0 4px 0 #CBD5E1 !important;
    cursor: not-allowed !important;
}
.btn-whatsapp:disabled {
    background: #A7F3D0 !important;
    box-shadow: 0 4px 0 #6EE7B7 !important;
    cursor: not-allowed;
}

/* ==========================================
   PÁGINAS ESTÁTICAS (Legal, Soporte, Contacto)
   ========================================== */
.static-page {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Ocupa todo el alto en móvil */
    max-height: 100vh;
}

@media (min-width: 480px) {
    .static-page {
        height: auto;
        min-height: 600px;
        max-height: 85vh; /* En escritorio es como una ventana emergente alta */
    }
}

/* Cabecera de navegación superior */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    z-index: 10;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    transition: 0.2s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.btn-back svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.btn-back:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.btn-back:active {
    transform: scale(0.95);
}

.page-logo {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
}

/* Contenido scrolleable (Texto Legal) */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px 24px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    /* Scrollbar sutil para webkit */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 10px; }

/* Tipografía para documentos legales */
.page-content h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand-black);
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.page-content .last-update {
    font-size: 0.85rem;
    color: var(--brand-blue);
    font-weight: 600;
    margin-bottom: 25px;
    display: block;
}

.page-content h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-black);
    margin-top: 25px;
    margin-bottom: 10px;
}

.page-content p {
    margin-bottom: 15px;
}

.page-content ul, .page-content ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

.page-content li {
    margin-bottom: 8px;
}

.page-content a {
    color: var(--brand-blue);
    text-decoration: underline;
    font-weight: 600;
}

/* Footer fijo en la parte inferior */
.page-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
}

.page-footer .btn-primary {
    margin-top: 0; /* Anula el margin-top base de tu estilo global */
}

/* ==========================================
   APP FOOTER (Pie de página de la Calculadora)
   ========================================== */
.app-footer {
    margin-top: auto; /* Empuja el footer siempre hacia abajo */
    padding: 20px 15px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

.app-footer p {
    margin-bottom: 8px;
    font-weight: 500;
}

.app-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.app-footer .footer-links a {
    color: var(--brand-blue);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.app-footer .footer-links a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.app-footer .separator {
    color: #CBD5E1; /* var(--border-color) */
    font-size: 0.6rem;
}