﻿/* Estilos TS */

.sundde-container {
    width: 100%;
    margin: 0 auto;
    position: relative;
    background: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* ESTRATEGIA: Desktop 45% vs Móvil 100% */

/* Desktop grande (más de 1200px) */
@media (min-width: 1200px) {

    .sundde-image-container {
        width: 45% !important;
        max-width: 800px !important;
        margin: 0 auto !important;
    }

    .sundde-image {
        width: 100% !important;
        height: auto !important;
        max-width: 800px !important;
    }

    /* Posiciones para imagen de 800px */
    .tasa-usd {
        top: 45% !important;
        left: 52.8% !important;
        width: 150px !important;
    }

    .tasa-eur {
        top: 53.5% !important;
        left: 52.8% !important;
        width: 150px !important;
    }

    .fecha {
        top: 62% !important;
        left: 53.5% !important;
        width: 150px !important;
    }

    .actualizacion {
        bottom: 3% !important;
        top: 95% !important;
        right: 160px !important;
    }

    .update-button-container {
        top: 68% !important;
        right: 39.1% !important;
    }

    /* Tamaños de fuente para desktop */
    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 19px !important;
    }

    #ultimaActualizacion {
        font-size: 10px !important;
    }
}

/* Desktop normal (992px a 1199px) */

@media (max-width: 1446px) {
    .tasa-usd {
        top: 45% !important;
        left: 52.8% !important;
        width: 150px !important;
    }

    .tasa-eur {
        top: 53.5% !important;
        left: 52.8% !important;
        width: 150px !important;
    }

    .fecha {
        top: 62% !important;
        left: 52.5% !important;
        width: 150px !important;
    }

    /* Tamaños de fuente para desktop */
    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 17px !important;
    }
}

@media (max-width: 1324px) {
    .tasa-usd {
        top: 45% !important;
        left: 51.8% !important;
        width: 150px !important;
    }

    .tasa-eur {
        top: 53.5% !important;
        left: 51.8% !important;
        width: 150px !important;
    }

    .fecha {
        top: 62% !important;
        left: 51.5% !important;
        width: 150px !important;
    }

    /* Tamaños de fuente para desktop */
    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 15.5px !important;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .sundde-container {
        max-width: 1200px;
    }

    .sundde-image-container {
        width: 55% !important;
        max-width: 700px !important;
    }

    .sundde-image {
        width: 100% !important;
        height: auto !important;
    }

    /* Ajustar posiciones proporcionalmente */
    .tasa-usd {
        top: 44.5% !important;
        left: 52.5% !important;
        width: 140px !important;
    }

    .tasa-eur {
        top: 53% !important;
        left: 52.5% !important;
        width: 140px !important;
    }

    .fecha {
        top: 61.5% !important;
        left: 52.5% !important;
        width: 140px !important;
    }

    .actualizacion {
        right: 150px !important;
        top: 470px !important;
    }

    .update-button-container {
        top: 68% !important;
        right: 37% !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 15px !important;
    }

    #ultimaActualizacion {
        font-size: 9px !important;
    }
}

@media (max-width: 1159px) {
    .actualizacion {
        right: 150px !important;
        top: 450px !important;
    }
}

@media (max-width: 1106px) {
    .actualizacion {
        right: 150px !important;
        top: 440px !important;
    }
}

@media (max-width: 1084px) {
    .actualizacion {
        right: 150px !important;
        top: 430px !important;
    }
}

@media (max-width: 1059px) {
    .actualizacion {
        right: 150px !important;
        top: 415px !important;
    }
}

@media (max-width: 1026px) {
    .actualizacion {
        right: 150px !important;
        top: 400px !important;
    }
}

/* Tablets grandes (768px a 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .sundde-image-container {
        width: 65% !important;
        max-width: 600px !important;
    }

    .sundde-image {
        width: 100% !important;
        height: auto !important;
    }

    .tasa-usd {
        top: 44% !important;
        left: 53% !important;
        width: 130px !important;
    }

    .tasa-eur {
        top: 53.5% !important;
        left: 53% !important;
        width: 130px !important;
    }

    .fecha {
        top: 62% !important;
        left: 53% !important;
        width: 130px !important;
    }

    .actualizacion {
        right: 138px !important;
        top: 435px !important;
    }

    .update-button-container {
        top: 68% !important;
        right: 35.5% !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 14px !important;
    }

    #ultimaActualizacion {
        font-size: 8px !important;
    }

    .update-button {
        padding: 6px 10px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 903px) {
    .actualizacion {
        right: 138px !important;
        top: 416px !important;
    }
}

/* DISPOSITIVOS MÓVILES */

/* Tablets pequeñas (576px a 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .sundde-image-container {
        width: 85% !important;
        max-width: 500px !important;
    }

    .sundde-image {
        width: 100% !important;
        height: auto !important;
    }

    .tasa-usd {
        top: 43.5% !important;
        left: 49.5% !important;
        width: 120px !important;
    }

    .tasa-eur {
        top: 52% !important;
        left: 49.5% !important;
        width: 120px !important;
    }

    .fecha {
        top: 60.5% !important;
        left: 49.5% !important;
        width: 120px !important;
    }

    .actualizacion {
        right: 150px !important;
    }

    .update-button-container {
        top: 65% !important;
        right: 28% !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 13px !important;
    }

    #ultimaActualizacion {
        font-size: 7px !important;
    }

    .update-button {
        padding: 5px 8px !important;
        font-size: 9px !important;
    }
}

/* Móviles grandes (480px a 575px) */
@media (min-width: 480px) and (max-width: 575px) {
    .sundde-image-container {
        width: 95% !important;
        max-width: 450px !important;
    }

    .sundde-container {
        padding: 15px 0 !important;
    }

    .tasa-usd {
        top: 43% !important;
        left: 49% !important;
        width: 110px !important;
    }

    .tasa-eur {
        top: 51.5% !important;
        left: 49% !important;
        width: 110px !important;
    }

    .fecha {
        top: 60% !important;
        left: 49% !important;
        width: 110px !important;
    }

    .actualizacion {
        right: 130px !important;
    }

    .update-button-container {
        top: 64% !important;
        right: 25% !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 12px !important;
    }

    #ultimaActualizacion {
        font-size: 6px !important;
        padding: 1px 3px !important;
    }

    .update-button {
        padding: 4px 6px !important;
        font-size: 8px !important;
    }

        /* Ocultar texto del botón */
        .update-button span:last-child {
            display: none;
        }
}

/* Móviles medianos (400px a 479px) */
@media (min-width: 400px) and (max-width: 479px) {
    .sundde-image-container {
        width: 100% !important;
        max-width: 400px !important;
    }

    .sundde-container {
        padding: 10px 0 !important;
    }

    .tasa-usd {
        top: 44.5% !important;
        left: 50.5% !important;
        width: 100px !important;
    }

    .tasa-eur {
        top: 53% !important;
        left: 50.5% !important;
        width: 100px !important;
    }

    .fecha {
        top: 62.5% !important;
        left: 51% !important;
        width: 100px !important;
    }

    .actualizacion {
        right: 110px !important;
    }

    .update-button-container {
        top: 63% !important;
        right: 22% !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 11px !important;
    }

    #ultimaActualizacion {
        font-size: 5px !important;
    }

    .update-button {
        padding: 3px 5px !important;
        font-size: 7px !important;
        min-width: 40px;
    }
}

/* Móviles pequeños (hasta 399px) */
@media (max-width: 399px) {
    .sundde-image-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 5px;
    }

    .tasa-usd {
        top: 45% !important;
        left: 52% !important;
        width: 90px !important;
    }

    .tasa-eur {
        top: 53.5% !important;
        left: 52% !important;
        width: 90px !important;
    }

    .fecha {
        top: 62% !important;
        left: 52% !important;
        width: 90px !important;
    }

    .actualizacion {
        right: 90px !important;
    }

    .update-button-container {
        top: 69% !important;
        right: 27% !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 10px !important;
    }

    #ultimaActualizacion {
        font-size: 4px !important;
        padding: 1px 2px !important;
    }
}

/* ESTILOS COMUNES PARA TODOS LOS DISPOSITIVOS */

.sundde-image-container {
    position: relative !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
}

.sundde-image {
    display: block !important;
    border-radius: 5px !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important;
    max-width: 55% !important;
    height: auto !important;
}

.text-overlay {
    position: absolute !important;
    text-align: center !important;
    transform-origin: center !important;
}

.tasa-usd div, .tasa-eur div, .fecha div {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
}

#tasaUsdDisplay, #tasaEurDisplay {
    font-family: 'Courier New', monospace !important;
    font-weight: bold !important;
    color: #d10000 !important;
    display: block !important;
    text-align: center !important;
    line-height: 1 !important;
}

#fechaDisplay {
    font-family: 'Courier New', monospace !important;
    font-weight: bold !important;
    color: #333 !important;
    display: block !important;
    text-align: center !important;
    line-height: 1 !important;
}

#ultimaActualizacion {
    font-family: Arial, sans-serif !important;
    color: #666 !important;
    background-color: rgba(255,255,255,0.8) !important;
    padding: 2px 5px !important;
    border-radius: 3px !important;
    white-space: nowrap !important;
}

.update-button-container {
    position: absolute !important;
    z-index: 10 !important;
}

.update-button {
    background: linear-gradient(to bottom, #d10000, #a00000) !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    padding: 5px;
}

    .update-button:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 8px rgba(209, 0, 0, 0.3) !important;
    }

    .update-button:disabled {
        opacity: 0.6 !important;
        cursor: not-allowed !important;
        transform: none !important;
    }

/* ANIMACIONES */

@keyframes tasaUpdate {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.tasa-updating {
    animation: tasaUpdate 0.5s ease;
}


/* Para asegurar que no afecte otras secciones */
.sundde-container + * {
    clear: both;
    margin-top: 0 !important;
}

/* Limpiar floats */
.sundde-container::after {
    content: "";
    display: table;
    clear: both;
}

/* Mejorar calidad en pantallas retina */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sundde-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Orientación horizontal en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .sundde-image-container {
        width: 70% !important;
        max-width: 500px !important;
    }

    .tasa-usd, .tasa-eur, .fecha {
        width: 120px !important;
    }

    #tasaUsdDisplay, #tasaEurDisplay, #fechaDisplay {
        font-size: 12px !important;
    }

    .update-button-container {
        top: 65% !important;
        right: 30% !important;
    }
}

/* Impresión */
@media print {
    .sundde-container {
        page-break-inside: avoid;
        break-inside: avoid;
        max-width: 100% !important;
    }

    .sundde-image-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .update-button-container {
        display: none !important;
    }

    #ultimaActualizacion {
        background-color: transparent !important;
    }
}
