/* ================================================
   styles.css
   Estilos para la calculadora bursátil (simplificado)
================================================ */

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2ecc71;
    --secondary-dark: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --gray: #7f8c8d;
    --gray-light: #ecf0f1;
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
    --border-radius: 16px;
}

/* Estilos generales */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    max-width: 1200px; 
    margin: 40px auto; 
    padding: 20px; 
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark);
    min-height: 100vh;
}

.container { 
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Header principal */
.header {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 25px 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.header p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

/* Widget del Dólar */
.dolar-widget {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s;
    min-width: 180px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.dolar-widget:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.dolar-widget .moneda-nombre {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dolar-widget .moneda-valores {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.valor-item {
    text-align: center;
}

.valor-item .label {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 3px;
}

.valor-item .valor {
    font-weight: bold;
    font-size: 16px;
}

.valor-item.compra .valor {
    color: var(--secondary);
}

.valor-item.venta .valor {
    color: var(--danger);
}

/* Modal de cotizaciones */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideIn 0.4s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
}

.modal-header h2 {
    margin: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--danger);
}

/* Detalle de cotización */
.cotizacion-detalle {
    padding: 20px 0;
}

.cotizacion-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(41, 128, 185, 0.05) 100%);
    margin-bottom: 20px;
}

.cotizacion-card h3 {
    margin: 0 0 20px 0;
    color: var(--dark);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cotizacion-valores {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.cotizacion-valor {
    text-align: center;
}

.cotizacion-valor .label {
    display: block;
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 5px;
}

.cotizacion-valor .valor {
    font-size: 22px;
    font-weight: bold;
}

.cotizacion-valor.compra .valor {
    color: var(--secondary);
}

.cotizacion-valor.venta .valor {
    color: var(--danger);
}

.spread {
    text-align: center;
    font-size: 14px;
    color: var(--gray);
    padding-top: 15px;
    border-top: 1px solid var(--gray-light);
    margin-top: 15px;
}

.spread .valor {
    font-weight: bold;
    color: var(--dark);
}

/* Info de actualización */
.actualizacion-info {
    background: var(--gray-light);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.actualizacion-info div {
    font-size: 14px;
    color: var(--dark);
}

/* Selector de modo */
.selector-modo {
    display: flex;
    background: var(--gray-light);
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #ddd;
}

.boton-modo {
    flex: 1;
    padding: 18px 20px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--gray);
    position: relative;
}

.boton-modo:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--dark);
}

.boton-modo.activo {
    color: var(--primary);
    background: white;
}

.boton-modo.activo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

/* Contenido principal */
.content {
    padding: 30px;
}

.formulario {
    display: none;
}

.formulario.activo {
    display: block;
    animation: fadeIn 0.5s ease;
}

/* Formularios */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.form-header h2 {
    margin: 0;
    color: var(--dark);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

input, select {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    box-sizing: border-box;
}

input:focus, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Botones */
button[type="submit"] {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 16px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.boton-ejemplo {
    background: var(--warning);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.boton-ejemplo:hover {
    background: #e67e22;
}

/* Resultados */
.resultado {
    margin-top: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.resultado-header {
    background: var(--primary);
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.resultado-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.resultado-content {
    padding: 30px;
    background: white;
}

/* Tarjetas y grids */
.comparativa {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.col {
    padding: 25px;
    border-radius: 10px;
    border: 2px solid transparent;
}

.col-teorico {
    background: var(--gray-light);
    border-color: #ddd;
}

.col-real {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, rgba(39, 174, 96, 0.1) 100%);
    border-color: rgba(46, 204, 113, 0.3);
}

.grid-resultado {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-top: 4px solid;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card.valor { border-color: var(--primary); }
.card.tasa { border-color: var(--secondary); }
.card.comision { border-color: var(--danger); }

.card h4 {
    margin-top: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.subtitulo {
    color: var(--gray);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.valor-grande {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    color: var(--dark);
}

/* Mensajes */
.nota {
    background: var(--gray-light);
    padding: 20px;
    border-radius: 8px;
    margin-top: 25px;
    border-left: 4px solid var(--warning);
}

.error {
    background: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--danger);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.success {
    background: rgba(46, 204, 113, 0.1);
    border-left: 4px solid var(--secondary);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .dolar-widget {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-top: 20px;
        width: 100%;
    }
    
    .comparativa {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
    
    .actualizacion-info {
        grid-template-columns: 1fr;
    }
    
    .selector-modo {
        flex-direction: column;
    }
    
    .boton-modo {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 24px;
    }
}