/**
 * @fileoverview Estilos personalizados para Calculadora AVEC
 * @description
 * Estilos personalizados basados en el diseño original, adaptados a Bootstrap 5.
 * Tema: Blanco hueso con esquema de colores claro y moderno.
 * 
 * Variables CSS principales:
 * - --bg, --bg2: Fondos en tonos blanco hueso
 * - --text, --muted: Textos oscuros para contraste
 * - --gold: Color de acento principal (dorado)
 * - --danger, --ok: Colores para valores monetarios
 * 
 * Responsive: Adaptado para móviles, tablets y desktop
 * Print: Estilos optimizados para impresión
 */

:root {
    --bg: #f5f5f0;
    --bg2: #fafaf5;
    --border: rgba(0, 0, 0, .12);
    --text: #2c2c2c;
    --muted: #6c757d;
    --green: #d4af37;
    --green2: #b8941f;
    --blue: #d4af37;
    --blue2: #b8941f;
    --gold: #d4af37;
    --gold2: #b8941f;
    --gray: #6c757d;
    --gray2: #5a6268;
    --danger: #dc3545;
    --ok: #28a745;
    --shadow: 0 18px 45px rgba(0, 0, 0, .15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #fafaf5 0%, #f5f5f0 50%, #f0f0eb 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 26px;
}

.container {
    max-width: 980px;
    background: linear-gradient(180deg, rgba(255, 255, 250, .98), rgba(250, 250, 245, .98));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 24px 26px 22px;
}

/* Brand */
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 6px;
}

.brand-logo {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .1));
}

.brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .8);
    border: 1px solid rgba(0, 0, 0, .1);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--green);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.brand-text strong {
    display: block;
    font-size: 14px;
    letter-spacing: .4px;
}

.brand-text span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

h1 {
    margin: 10px 0 6px;
    text-align: center;
    color: var(--green);
    font-weight: 900;
    font-size: 46px;
    letter-spacing: .4px;
}

/* Formulario */
.form-container {
    margin-top: 18px;
}

.form-label {
    font-size: 16px;
    color: var(--text);
    opacity: .92;
    margin: 14px 0 8px;
}

.form-select,
.form-control {
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 16px;
}

.form-select {
    background-color: #ffffff !important;
    color: var(--text) !important;
    text-shadow: none !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

.form-select option {
    background-color: #ffffff !important;
    color: var(--text) !important;
}

.form-select option:hover,
.form-select option:checked {
    background-color: #f0f0eb !important;
    color: var(--text) !important;
}

.form-control::placeholder {
    color: rgba(108, 117, 125, .6);
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 1);
    border-color: var(--gold);
    color: var(--text);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, .25);
}

.form-text {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

.form-check-label {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    opacity: 1;
}

/* Recargos Box */
.recargos-box {
    margin-top: 18px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, .1);
    background: rgba(255, 255, 255, .6);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.recargos-title {
    color: var(--green);
    font-weight: 900;
    font-size: 24px;
    margin: 0 0 10px;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 6px;
    border-radius: 8px;
}

.check-row:hover {
    background: rgba(0, 0, 0, .03);
}

.inline-input {
    margin-left: 28px;
    margin-top: 8px;
}

.small-note {
    margin-left: 28px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.spacer {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

/* Botones */
.btn-row {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.btn {
    border: 2px solid;
    border-radius: 10px;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
    z-index: 0;
}

.btn:hover::before {
    left: 100%;
}

.btn > * {
    position: relative;
    z-index: 1;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    border-color: rgba(108, 117, 125, 0.4);
    color: var(--muted);
    background: rgba(108, 117, 125, 0.05);
}

.btn-secondary:hover {
    border-color: rgba(108, 117, 125, 0.6);
    color: var(--text);
    background: rgba(108, 117, 125, 0.1);
}

.btn-success {
    border-color: rgba(212, 175, 55, 0.5) !important;
    color: #b8941f !important;
    background: rgba(212, 175, 55, 0.08) !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:focus-visible {
    border-color: rgba(212, 175, 55, 0.8) !important;
    color: #9a7a1a !important;
    background: rgba(212, 175, 55, 0.15) !important;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2) !important;
}

.btn-success:active,
.btn-success.active {
    border-color: rgba(212, 175, 55, 0.9) !important;
    color: #8a6a15 !important;
    background: rgba(212, 175, 55, 0.2) !important;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25) !important;
}

.btn-success:disabled,
.btn-success.disabled {
    border-color: rgba(212, 175, 55, 0.3) !important;
    color: rgba(184, 148, 31, 0.5) !important;
    background: rgba(212, 175, 55, 0.05) !important;
    opacity: 0.6;
}

.btn-primary {
    border-color: rgba(212, 175, 55, 0.5) !important;
    color: #b8941f !important;
    background: rgba(212, 175, 55, 0.08) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:focus-visible {
    border-color: rgba(212, 175, 55, 0.8) !important;
    color: #9a7a1a !important;
    background: rgba(212, 175, 55, 0.15) !important;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2) !important;
}

.btn-primary:active,
.btn-primary.active {
    border-color: rgba(212, 175, 55, 0.9) !important;
    color: #8a6a15 !important;
    background: rgba(212, 175, 55, 0.2) !important;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25) !important;
}

/* Texto primary (dorado) */
.text-primary {
    color: var(--gold) !important;
}

/* Resultado */
.result-box {
    margin-top: 16px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, .1);
    background: rgba(255, 255, 255, .8);
    padding: 16px;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.result-box h2 {
    margin: 0 0 10px;
    color: var(--green);
    font-size: 34px;
    font-weight: 900;
}

.result-line {
    margin: 8px 0;
    font-size: 19px;
    line-height: 1.35;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.result-line b {
    font-weight: 900;
}

.money {
    color: var(--danger);
    font-weight: 900;
}

.result-hr {
    height: 1px;
    background: rgba(0, 0, 0, .12);
    margin: 12px 0;
    border: none;
}

.result-total {
    margin-top: 6px;
    font-size: 26px;
    font-weight: 900;
}

.money-ok {
    color: var(--ok);
    font-weight: 900;
}

/* Responsive - Pantallas medianas */
@media (max-width: 860px) {
    h1 {
        font-size: 36px;
    }

    .btn-row {
        grid-template-columns: 1fr;
    }

    .brand {
        justify-content: center;
    }
}

/* Tablet y pantallas medianas */
@media (max-width: 900px) {
    body {
        padding: 12px;
    }

    .container {
        width: 100%;
        padding: 18px 16px 16px;
    }

    .brand {
        justify-content: center !important;
        text-align: center !important;
    }

    .brand-logo {
        width: 132px;
        height: 132px;
    }
    
    .brand-icon {
        width: 96px;
        height: 96px;
        border-radius: 18px;
        padding: 10px;
        font-size: 48px;
        background: rgba(255, 255, 255, .9);
        border: 1px solid rgba(0, 0, 0, .1);
    }

    h1 {
        font-size: 34px;
        line-height: 1.08;
        margin-top: 14px;
    }

    .form-label {
        font-size: 15px;
    }

    .form-select,
    .form-control {
        font-size: 16px;
        padding: 12px;
    }

    .btn-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .btn {
        font-size: 15px;
        padding: 12px 16px;
    }
    
    .btn i {
        font-size: 16px;
    }
}

/* Móviles - Estilo sin card (sin contenedor con fondo) */
@media (max-width: 768px) {
    body {
        padding: 0;
        background: var(--bg);
        overflow-x: hidden;
    }
    
    html {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .container {
        max-width: 100%;
        width: 100%;
        background: transparent;
        border: none;
        overflow-x: hidden;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .form-label {
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        line-height: 1.5;
        max-width: 100%;
        overflow-wrap: break-word;
    }
    
    .form-label.fw-bold {
        font-size: 0.95rem;
    }
        border-radius: 0;
        box-shadow: none;
        padding: 16px;
    }

    .brand {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 20px;
        padding: 12px 0;
    }

    .brand-logo {
        width: 144px;
        height: 144px;
        margin-bottom: 8px;
    }

    .brand-text {
        text-align: center;
    }

    .brand-text strong {
        font-size: 16px;
    }

    .brand-text span {
        font-size: 13px;
    }

    h1 {
        font-size: 28px;
        margin: 8px 0 4px;
        line-height: 1.2;
    }

    .text-center.text-muted {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .form-container {
        margin-top: 0;
    }

    .form-label {
        font-size: 14px;
        margin: 12px 0 6px;
        font-weight: 600;
    }

    .form-select,
    .form-control {
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
    }

    .recargos-box {
        margin-top: 16px;
        padding: 12px;
        border-radius: 8px;
        background: rgba(255, 255, 255, .6);
    }

    .recargos-title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .check-row {
        padding: 8px 4px;
    }

    .check-row label {
        font-size: 14px;
    }

    .btn-row {
        margin-top: 20px;
        gap: 12px;
    }

    .btn {
        font-size: 15px;
        padding: 14px 18px;
        border-radius: 8px;
        width: 100%;
    }

    .result-box {
        margin-top: 20px;
        padding: 16px;
        border-radius: 8px;
        background: rgba(255, 255, 255, .9);
        border: 1px solid rgba(0, 0, 0, .08);
    }

    .result-box h2 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .result-line {
        font-size: 16px;
        margin: 6px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-line b {
        font-size: 15px;
    }

    .result-total {
        font-size: 20px;
        margin-top: 12px;
        line-height: 1.4;
    }

    .result-hr {
        margin: 10px 0;
    }

    /* Mejoras adicionales para móviles */
    .form-text {
        font-size: 12px;
    }

    .small-note {
        font-size: 12px;
        margin-left: 0;
        margin-top: 6px;
    }

    .inline-input {
        margin-left: 0;
        margin-top: 8px;
    }

    .money,
    .money-ok {
        font-size: 16px;
        word-break: break-word;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .brand-logo {
        width: 115px;
        height: 115px;
    }

    h1 {
        font-size: 24px;
    }

    .form-label {
        word-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        line-height: 1.4;
        font-size: 13px;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .recargos-title {
        font-size: 18px;
    }

    .result-box h2 {
        font-size: 20px;
    }

    .result-line {
        font-size: 14px;
    }

    .result-total {
        font-size: 18px;
    }
}

/* Botón Menú Hamburguesa */
.btn-menu-hamburger {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid rgba(212, 175, 55, 0.3);
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
}

.btn-menu-hamburger:hover {
    background: var(--gold2);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.4);
}

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

/* Modal desde la izquierda al 50% */
.modal-left {
    padding-left: 0 !important;
}

.modal-left .modal-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 50%;
    max-width: 50%;
    height: 100vh;
    margin: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
}

.modal-left.show .modal-dialog,
.modal-left.showing .modal-dialog,
.modal-left:not(.fade) .modal-dialog {
    transform: translateX(0);
}

.modal-left.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

.modal-left.fade.show .modal-dialog {
    transform: translateX(0);
}

.modal-left .modal-content {
    height: 100%;
    border-radius: 0;
    border-left: none;
    border-top: none;
    border-bottom: none;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 250, .98), rgba(250, 250, 245, .98));
}

.modal-left .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 250, .98), rgba(250, 250, 245, .98));
}

.modal-left .modal-title {
    color: var(--gold);
    font-weight: 700;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-left .modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-left .modal-footer {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    background: rgba(255, 255, 255, .5);
}

/* Card de Contacto */
.contact-card {
    background: rgba(255, 255, 255, .9);
    border-radius: 12px;
    padding: 24px;
}

.contact-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.contact-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.contact-logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.contact-header h4 {
    color: var(--gold);
    font-weight: 700;
    font-size: 22px;
    margin: 0 0 4px 0;
}

.contact-header p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.contact-info {
    margin-top: 24px;
}

.contact-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-start;
    padding-left: 8px;
}

.contact-item i {
    font-size: 24px;
    color: var(--gold);
    flex-shrink: 0;
    margin-top: 2px;
}

.contact-item strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.contact-item p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.contact-item a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.2s;
}

.contact-item a:hover {
    color: var(--gold2);
    text-decoration: underline;
}

.contact-social {
    margin-top: 32px;
    padding-top: 24px;
    padding-bottom: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 140px;
    max-width: 200px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 20px;
    border-radius: 8px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid rgba(212, 175, 55, 0.3);
    color: var(--gold);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.social-link i {
    font-size: 20px;
    flex-shrink: 0;
}

.social-link span {
    color: var(--gold);
}

.social-link:hover {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
}

.social-link:hover span {
    color: #fff;
}

/* Responsive para Modal */
@media (max-width: 768px) {
    .modal-left .modal-dialog {
        width: 85%;
        max-width: 85%;
    }

    .btn-menu-hamburger {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .contact-logo img {
        width: 60px;
        height: 60px;
    }

    .contact-header h4 {
        font-size: 18px;
    }

    .contact-item {
        margin-bottom: 20px;
    }

    .contact-item i {
        font-size: 20px;
    }

    .contact-social {
        gap: 10px;
    }

    .social-item {
        min-width: 120px;
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .modal-left .modal-dialog {
        width: 100%;
        max-width: 100%;
    }

    .btn-menu-hamburger {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .contact-social {
        gap: 8px;
    }

    .social-item {
        min-width: 100px;
        max-width: 150px;
        flex: 1;
    }

    .social-link {
        padding: 10px 16px;
        font-size: 14px;
    }

    .social-link i {
        font-size: 18px;
    }
}

/* Botón Flotante de WhatsApp */
.btn-whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    text-decoration: none;
    transition: all 0.3s ease;
    animation: pulse-whatsapp 2s infinite;
}

.btn-whatsapp-float:hover {
    background: #20BA5A;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    color: #fff;
}

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

@keyframes pulse-whatsapp {
    0% {
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6), 0 0 0 10px rgba(37, 211, 102, 0.1);
    }
    100% {
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    }
}

/* Estilo para enlace de WhatsApp en modal */
.social-link-whatsapp {
    background: rgba(37, 211, 102, 0.1) !important;
    border-color: rgba(37, 211, 102, 0.3) !important;
    color: #25D366 !important;
}

.social-link-whatsapp i {
    color: #25D366 !important;
}

.social-link-whatsapp span {
    color: #25D366 !important;
}

.social-link-whatsapp:hover {
    background: #25D366 !important;
    border-color: #25D366 !important;
    color: #fff !important;
}

.social-link-whatsapp:hover i,
.social-link-whatsapp:hover span {
    color: #fff !important;
}

/* Responsive para botón WhatsApp flotante */
@media (max-width: 768px) {
    .btn-whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .btn-whatsapp-float {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .btn-row {
        display: none;
    }

    .result-box {
        display: block !important;
        border: 1px solid #ccc;
        background: white;
        color: black;
    }

    .btn-whatsapp-float {
        display: none;
    }
}
