/* ===================================
   RESET Y ESTILOS GLOBALES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #dfe7e7;
    min-height: 100vh;
    padding: 20px;
}

/* ===================================
   CONTENEDOR PRINCIPAL
   =================================== */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

/* ===================================
   CONTROLES E INPUTS
   =================================== */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #555;
}

.input-group input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.input-with-btn {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-with-btn input {
    flex: 1;
}

.btn-refresh {
    padding: 10px;
    font-size: 20px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-refresh:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.update-text {
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ===================================
   BOTONES
   =================================== */
.buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

button {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-download {
    background: #3b82f6;
    color: white;
}

/* ===================================
   PREVISUALIZACIÓN
   ===================================*/
/* Previsualización SVG */
.preview-container {
    width: 100%;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    background: transparent;
    border-radius: var(--radius);
    overflow: hidden;
}

#svgContainer {
    width: 100%;
    max-width: 1200px;
    /* Ancho máximo razonable para pantallas grandes */
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 0;
}

#svgContainer svg {
    width: 100%;
    height: auto;
    max-height: 85vh;
    /* Evita que ocupe más de la pantalla verticalmente */
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    display: block;
}

.placeholder {
    color: var(--text-light);
    font-style: italic;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header h2 {
    font-size: 32px;
    font-weight: 900;
    text-decoration: underline;
    margin: 0;
}

.header .tasa-numero {
    font-size: 80px;
    /* TAMAÑO TASA PESOS */
    font-weight: 700;
    color: #000;
}

/* ===================================
   BANDERAS Y LOGOS
   =================================== */
.banderas {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding: 5px 0 5px;
    margin-bottom: 10px;
    border-bottom: 3px solid #000;
}

.bandera {
    text-align: center;
    flex-basis: 25%;
}

.logo-item {
    text-align: center;
    flex-basis: 20%;
}

.bandera-img {
    width: 100%;
    max-width: 90px;
    height: auto;
    margin-bottom: 5px;
}

.logo-img {
    width: 100%;
    max-width: 60px;
    height: auto;
    margin-bottom: 5px;
}

.bandera-texto {
    font-style: normal;
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

/* ===================================
   TASA DEL DÓLAR
   =================================== */
.tasa-dolar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: none;
    margin-bottom: 5px;
}

.tasa-dolar span:first-child {
    font-size: 32px;
    font-weight: 900;
    text-decoration: underline;
}

.tasa-dolar span:last-child {
    font-size: 60px;
    /* TAMAÑO TASA DOLAR */
    font-weight: 300;
    color: #000;
}

/* ===================================
   TABLA DE CONVERSIONES
   =================================== */
table {
    width: 100%;
    border-collapse: collapse;
    border-top: 1px solid #333;
    margin-top: 10px;
}

th {
    text-align: center;
    padding: 12px 10px;
    font-size: 24px;
    font-weight: 900;
    border-bottom: 3px solid #000;
}

td {
    text-align: center;
    padding: 18px 10px;
    font-size: 32px;
    border-bottom: none;
    font-weight: 900;
}

.total-row {
    font-weight: 900;
    color: #008000;
    font-size: 36px;
    border-top: 3px solid #000;
}

.total-row td {
    padding-top: 20px;
    border-bottom: none;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (min-width: 768px) {
    .tasa-dolar {
        flex-direction: row;
    }
}

/* ===================================
   MOBILE RESPONSIVE (Max-width: 768px)
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        width: 100%;
        border-radius: 15px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .controls {
        grid-template-columns: 1fr;
        /* Stack vertically */
        gap: 15px;
    }

    .buttons {
        flex-direction: column;
        width: 100%;
    }

    .buttons button {
        width: 100%;
        justify-content: center;
    }

    /* Adjust SVG Container for mobile */
    #svgContainer {
        min-height: 250px;
        margin-top: 1rem;
    }

    /* Ensure SVG scales */
    #svgContainer svg {
        height: auto;
        max-height: 60vh;
    }

    .tasa-dolar {
        flex-direction: column;
        /* Stack dollar rate items */
        text-align: center;
    }
}