/* Responsive Design - Optimizado para móviles */

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pairs-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .news-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .analysis-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    /* Mejoras para tablets */
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .hero-container {
        padding: 0 1.5rem;
    }
    
    .container {
        padding: 0 1.5rem;
    }
}

/* Móviles grandes - Optimizado */
@media (max-width: 768px) {
    /* Navegación móvil mejorada */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: all 0.3s ease;
        box-shadow: var(--shadow-lg);
        padding: 2rem 0;
        z-index: 1000;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        /* Prevenir duplicación de elementos */
        contain: layout style;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 0.5rem 0;
        width: 100%;
    }

    .nav-link {
        padding: 1rem 2rem;
        display: block;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--border-color);
        transition: all 0.3s ease;
    }

    .nav-link:hover {
        background-color: var(--bg-secondary);
        color: var(--primary-color);
    }

    /* Dropdown móvil mejorado */
    .dropdown-menu {
        position: static;
        background-color: var(--bg-secondary);
        box-shadow: none;
        border-radius: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        display: none;
    }

    .dropdown-menu.active {
        display: block;
    }

    .dropdown-menu li {
        border-bottom: 1px solid var(--border-color);
    }

    .dropdown-menu a {
        padding: 0.75rem 3rem;
        font-size: 0.95rem;
        color: var(--text-secondary);
    }

    /* Hamburger menu mejorado */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 30px;
        cursor: pointer;
        padding: 0;
        background: none;
        border: none;
    }

    .nav-toggle .bar {
        width: 100%;
        height: 3px;
        background-color: var(--primary-color);
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Hero section optimizado para móviles */
    .hero {
        padding: 3rem 0;
        margin-top: 70px;
    }

    .hero-title {
        font-size: 2.5rem;
        line-height: 1.1;
        margin-bottom: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
        margin-bottom: 2.5rem;
        padding: 0 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-bottom: 3rem;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 280px;
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 3rem;
    }

    .stat-card {
        padding: 1.5rem;
        text-align: center;
    }

    /* Secciones generales */
    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .container {
        padding: 0 1rem;
    }

    /* Market tabs optimizado */
    .market-tabs {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .market-tab {
        width: 100%;
        max-width: 200px;
        padding: 0.75rem 1rem;
    }

    .market-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    /* Grids optimizados */
    .pairs-grid,
    .tools-grid,
    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* News grid optimizado para móviles */
    .news-grid {
        gap: 1.5rem;
    }

    .news-item {
        border-radius: var(--border-radius);
    }

    .news-body {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .news-image-container {
        height: 200px;
    }

    .news-text {
        padding: 1rem;
    }

    .news-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .news-summary {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    .btn-read-more {
        padding: 0.625rem 1.25rem;
        font-size: 0.8rem;
    }

    /* Cards optimizadas */
    .pair-card,
    .tool-card,
    .news-card,
    .analysis-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    /* Footer optimizado */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .footer-section h3 {
        margin-bottom: 1rem;
    }

    .footer-section ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    /* Modales optimizados */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    /* Formularios optimizados */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 1rem;
        font-size: 1rem;
    }

    /* Botones optimizados para touch */
    .btn {
        min-height: 48px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        touch-action: manipulation;
    }
}

/* Móviles pequeños - Ultra optimizado */
@media (max-width: 480px) {
    /* Contenedores más compactos */
    .container {
        padding: 0 0.75rem;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .hero-container {
        padding: 0 1rem;
    }

    /* Hero ultra compacto */
    .hero {
        padding: 2rem 0;
        margin-top: 70px;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.1;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
        padding: 0 0.5rem;
    }

    .hero-buttons {
        gap: 0.75rem;
        margin-bottom: 2rem;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 250px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .hero-stats {
        gap: 1rem;
        margin-top: 2rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .stat-info h3 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .stat-info p {
        font-size: 0.875rem;
    }

    /* Tipografía optimizada */
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Cards ultra compactas */
    .pair-card,
    .tool-card,
    .news-card,
    .analysis-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .card-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .card-description {
        font-size: 0.875rem;
        line-height: 1.5;
    }

    /* Navegación móvil ultra compacta */
    .nav-link {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .dropdown-menu a {
        padding: 0.625rem 2.5rem;
        font-size: 0.9rem;
    }

    /* Modales ultra compactos */
    .modal-content {
        width: 98%;
        margin: 2% auto;
        max-height: 96vh;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .close {
        font-size: 1.5rem;
        width: 32px;
        height: 32px;
    }

    /* Formularios ultra compactos */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* Botones ultra optimizados */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    /* Footer ultra compacto */
    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-content {
        gap: 1.5rem;
    }

    .footer-section h3 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .footer-section ul {
        gap: 0.75rem;
    }

    .footer-section a {
        font-size: 0.875rem;
    }
}

/* Pantallas muy pequeñas - Ultra compacto */
@media (max-width: 320px) {
    /* Contenedores mínimos */
    .container {
        padding: 0 0.5rem;
    }

    .nav-container {
        padding: 0 0.75rem;
    }

    .hero-container {
        padding: 0 0.75rem;
    }

    /* Hero mínimo */
    .hero {
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 1.75rem;
        line-height: 1.1;
        margin-bottom: 0.75rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons .btn {
        max-width: 220px;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    .hero-stats {
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-icon {
        font-size: 1.25rem;
    }

    .stat-info h3 {
        font-size: 1.25rem;
    }

    .stat-info p {
        font-size: 0.8rem;
    }

    /* Tipografía mínima */
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* Cards mínimas */
    .pair-card,
    .tool-card,
    .news-card,
    .analysis-card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .card-description {
        font-size: 0.8rem;
    }

    /* Elementos específicos */
    .pair-symbol {
        font-size: 1.125rem;
    }

    .pair-price {
        font-size: 1.25rem;
    }

    .tool-icon {
        font-size: 2.5rem;
    }

    .tool-card h3 {
        font-size: 1.125rem;
    }

    /* Navegación mínima */
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .dropdown-menu a {
        padding: 0.5rem 2rem;
        font-size: 0.85rem;
    }

    /* Botones mínimos */
    .btn {
        min-height: 40px;
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        min-height: 32px;
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Footer mínimo */
    .footer {
        padding: 1.5rem 0 0.75rem;
    }

    .footer-section h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .footer-section a {
        font-size: 0.8rem;
    }
}

/* Mejoras adicionales para móviles */

/* Banner de cookies optimizado para móviles */
@media (max-width: 768px) {
    .cookie-banner {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
        padding: 1rem;
        z-index: 1000;
        max-height: 50vh;
        overflow-y: auto;
    }

    .cookie-banner-content {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .cookie-banner h3 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .cookie-banner p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    .cookie-banner-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cookie-banner .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    .cookie-settings {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }

    .cookie-category {
        margin-bottom: 1rem;
    }

    .cookie-category h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .cookie-category p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
}

/* Optimización para landscape en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons .btn {
        width: auto;
        max-width: 200px;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .modal-content {
        width: 90%;
        margin: 2% auto;
        max-height: 95vh;
    }
}

/* Mejoras para touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar área de toque para elementos interactivos */
    .nav-link,
    .btn,
    .market-tab,
    .news-tab {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mejorar feedback visual para toques */
    .btn:active,
    .nav-link:active,
    .market-tab:active,
    .news-tab:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Optimizar scroll en móviles */
    .nav-menu {
        -webkit-overflow-scrolling: touch;
    }

    .modal-content {
        -webkit-overflow-scrolling: touch;
    }

    .cookie-banner {
        -webkit-overflow-scrolling: touch;
    }
}

/* Mejoras para accesibilidad en móviles */
@media (max-width: 768px) {
    /* Mejorar contraste en elementos pequeños */
    .nav-link,
    .dropdown-menu a,
    .footer-section a {
        color: var(--text-primary);
    }

    .nav-link:hover,
    .dropdown-menu a:hover,
    .footer-section a:hover {
        color: var(--primary-color);
        background-color: var(--bg-secondary);
    }

    /* Mejorar legibilidad de texto */
    .hero-subtitle,
    .section-subtitle,
    .card-description {
        line-height: 1.6;
    }

    /* Mejorar espaciado para lectura */
    .news-card .card-content,
    .analysis-card .card-content {
        line-height: 1.6;
    }

    /* Optimizar imágenes para móviles */
    .hero-image,
    .card-image {
        max-width: 100%;
        height: auto;
        border-radius: var(--border-radius);
    }

    /* Mejorar formularios para móviles */
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: 2px solid var(--accent-color);
        outline-offset: 2px;
    }
}

/* Optimización para pantallas de alta densidad */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .nav-toggle .bar {
        height: 2px;
    }

    .hero-title,
    .section-title {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Modo oscuro deshabilitado - Forzar tema claro en móviles */
@media (prefers-color-scheme: dark) and (min-width: 769px) {
    :root {
        --bg-primary: #1e293b;
        --bg-secondary: #0f172a;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --border-color: #334155;
    }

    .hero {
        background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    }

    .modal-content {
        background-color: var(--bg-primary);
    }
}

/* Forzar tema claro en móviles */
@media (max-width: 768px) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f8fafc;
        --bg-tertiary: #f1f5f9;
        --text-primary: #1e293b;
        --text-secondary: #64748b;
        --text-muted: #94a3b8;
        --border-color: #e2e8f0;
    }

    body {
        background-color: #ffffff !important;
        color: #1e293b !important;
    }

    .hero {
        background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%) !important;
        color: #ffffff !important;
    }

    .modal-content {
        background-color: #ffffff !important;
        color: #1e293b !important;
    }
}

/* Impresión */
@media print {
    .header,
    .footer,
    .nav-toggle,
    .modal,
    .loading {
        display: none !important;
    }

    .main-content {
        margin-top: 0;
    }

    .hero {
        background: none !important;
        color: black !important;
    }

    .pair-card,
    .tool-card,
    .news-card,
    .analysis-card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
        --text-muted: #333333;
    }

    .pair-card,
    .tool-card,
    .news-card,
    .analysis-card {
        border: 2px solid #000000;
    }
}

/* Orientación landscape en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-menu {
        top: 60px;
    }
}



