/* =============================================
   G2 MC CONSULTING - Responsive Styles
   Media Queries y Adaptación Mobile
   Versión 2.0 - Menú Mobile Corregido
   ============================================= */

/* Logo en Menu a la izquierda */
@media (min-width: 993px) {
  .navbar-menu {
    padding-left: 3rem; 
  }
}

/* ========== Tablets y Dispositivos Medianos (max-width: 992px) ========== */
@media (max-width: 992px) {

    /* Typography */
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

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

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

    /* Header: logo pegado al borde izquierdo en mobile */
    .header .container { 
        padding-left: 0;                 /* anula el padding del contenedor solo en el header */
    }
    .navbar-brand { margin-left: 0; }   /* por si acaso hubiese margen */
    
    /* Navigation - MOBILE MENU CORREGIDO */
    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: var(--white);
        flex-direction: column;
        padding: var(--spacing-xxl) var(--spacing-lg);
        box-shadow: var(--shadow-xl);
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 1000;
        align-items: flex-start;
        gap: 0;
    }

    .navbar-menu.active {
        right: 0;
    }

    .navbar-menu li {
        width: 100%;
        margin: 0;
        padding: var(--spacing-sm) 0;
        border-bottom: 1px solid var(--gray-light);
    }

    .navbar-menu li:last-child {
        border-bottom: none;
    }

    .nav-link {
        display: block;
        width: 100%;
        padding: var(--spacing-sm) 0;
        font-size: 1.125rem;
    }

    .nav-link::after {
        display: none;
    }

    /* Dropdown en mobile */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: var(--bg-light);
        margin-top: var(--spacing-sm);
        margin-left: var(--spacing-md);
        border-radius: var(--radius-md);
        display: none;
    }

    .has-dropdown.open .dropdown-menu {
        display: block;
    }

    .dropdown-menu a {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 1rem;
    }

    /* CTA Button en mobile */
    .navbar-cta {
        width: 100%;
        margin: var(--spacing-md) 0 0 0;
    }

    .navbar-cta .btn {
        width: 100%;
        justify-content: center;
    }

    /* Toggle Button */
    .navbar-toggle {
        display: block;
    }

    /* Overlay cuando el menú está abierto */
    .navbar-menu.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 300px;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    /* Hero Section */
    .hero-section {
        padding: var(--spacing-xl) 0;
        min-height: calc(100vh - var(--header-height));
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

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

    .hero-stats {
        flex-wrap: wrap;
        gap: var(--spacing-lg);
    }

    .stat-item {
        flex: 0 0 45%;
    }

    /* Services & Products Grid */
    .services-grid,
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: var(--spacing-md);
    }

    /* Team Grid */
    .team-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    /* Values Grid */
    .values-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    /* Footer */
    .footer-legal {
        justify-content: flex-start;
        margin-top: var(--spacing-sm);
    }

    .footer-legal li {
        margin-left: 0;
        margin-right: var(--spacing-md);
    }
}

/* ========== Mobile Devices (max-width: 768px) ========== */
@media (max-width: 768px) {

    /* Root Variables Adjustments */
    :root {
        --spacing-xxl: 3rem;
        --spacing-xl: 2rem;
        --header-height: 70px;
    }

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

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

    /* Container */
    .container {
        padding: 0 var(--spacing-sm);
    }

    /* Hero Section */
    .hero-title {
        font-size: 2.25rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-md);
        width: 100%;
    }

    .stat-item {
        flex: 0 0 100%;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    /* About Section */
    .about-text {
        padding-right: 0;
        margin-bottom: var(--spacing-lg);
    }

    .about-features {
        grid-template-columns: 1fr;
    }

    /* Vision & Mission */
    .vision-box,
    .mission-box {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-md);
    }

    .icon-box {
        width: 60px;
        height: 60px;
    }

    .icon-box i {
        font-size: 1.5rem;
    }

    /* Values Grid */
    .values-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .value-card {
        padding: var(--spacing-lg);
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: 1fr;
    }

    .service-card-header {
        height: 180px;
    }

    .service-icon {
        font-size: 3rem;
    }

    /* Team Grid */
    .team-grid {
        grid-template-columns: 1fr;
    }

    .team-member {
        max-width: 400px;
        margin: 0 auto var(--spacing-lg);
    }

    .team-member-image {
        height: 280px;
    }

    /* Contact Section */
    .contact-form-wrapper,
    .contact-info {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }

    .info-item {
        margin-bottom: var(--spacing-lg);
    }

    .info-item i {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }

    /* Map */
    .map-container iframe {
        height: 350px;
    }

    /* Footer */
    .footer {
        padding: var(--spacing-xl) 0 var(--spacing-sm);
    }

    .footer-widget {
        margin-bottom: var(--spacing-md);
    }

    .footer-logo {
        height: 50px;
    }

    .footer-bottom {
        text-align: center;
    }

    .footer-legal {
        justify-content: center;
    }

    /* Buttons flotantes */
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 1.125rem;
    }

    .whatsapp-btn {
        width: 55px;
        height: 55px;
        bottom: 75px;
        right: 20px;
        font-size: 1.75rem;
    }
}

/* ========== Small Mobile Devices (max-width: 576px) ========== */
@media (max-width: 576px) {

    /* Typography */
    body {
        font-size: 15px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Hero Section */
    .hero-section {
        padding: var(--spacing-lg) 0;
    }

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

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

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    /* Section Headers */
    .section {
        padding: var(--spacing-xl) 0;
    }

    .section-header {
        margin-bottom: var(--spacing-lg);
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    /* About Section */
    .about-text .lead {
        font-size: 1rem;
    }

    /* Vision & Mission */
    .vision-box,
    .mission-box {
        padding: var(--spacing-md);
    }

    .icon-box {
        width: 55px;
        height: 55px;
    }

    .icon-box i {
        font-size: 1.25rem;
    }

    /* Values */
    .value-card {
        padding: var(--spacing-md);
    }

    .value-card .icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    /* Services */
    .service-card-header {
        height: 160px;
    }

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

    .service-card-body {
        padding: var(--spacing-md);
    }

    .service-features li {
        font-size: 0.9rem;
    }

    /* Team */
    .team-member-image {
        height: 250px;
    }

    .team-member-image i {
        font-size: 4rem;
    }

    .team-member-info {
        padding: var(--spacing-md);
    }

    /* Contact Form */
    .contact-form-wrapper {
        padding: var(--spacing-md);
    }

    .form-control {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.95rem;
    }

    textarea.form-control {
        min-height: 120px;
    }

    /* Info Items */
    .info-item {
        margin-bottom: var(--spacing-md);
    }

    .info-item i {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .info-item h4 {
        font-size: 1rem;
    }

    .info-item p {
        font-size: 0.9rem;
    }

    /* Social Links */
    .social-links a {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }

    /* Map Container */
    .map-container iframe {
        height: 300px;
    }

    /* Footer */
    .footer-widget h4 {
        font-size: 1.125rem;
    }

    .footer-links a,
    .footer-contact span {
        font-size: 0.9rem;
    }

    .copyright {
        font-size: 0.85rem;
    }

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

    /* Social Links in Footer */
    .social-links a {
        width: 42px;
        height: 42px;
    }
}

/* ========== Very Small Devices (max-width: 375px) ========== */
@media (max-width: 375px) {

    /* Hero Section */
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    /* Mobile Menu más estrecho */
    .navbar-menu {
        width: 280px;
    }

    .navbar-menu.active::before {
        right: 280px;
    }

    /* Values */
    .value-card {
        padding: var(--spacing-sm);
    }

    .value-card .icon {
        width: 55px;
        height: 55px;
    }
}

/* ========== Landscape Mobile ========== */
@media (max-width: 992px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--spacing-xl) 0;
    }

    .hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .stat-item {
        flex: 0 0 calc(33.333% - var(--spacing-md));
    }
}

/* ========== Print Styles ========== */
@media print {

    /* Hide unnecessary elements */
    .navbar-toggle,
    .navbar-cta,
    .back-to-top,
    .whatsapp-btn,
    .hero-buttons,
    #scroll-progress,
    .theme-toggle { /* NUEVO: Ocultar botón de tema al imprimir */
        display: none !important;
    }

    /* Adjust colors for print */
    body {
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    /* Page breaks */
    .section {
        page-break-after: auto;
        page-break-inside: avoid;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        page-break-after: avoid;
    }
}

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

    html {
        scroll-behavior: auto;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #D50000;
        --secondary-color: #0D47A1;
        --gray-dark: #000000;
        --gray-light: #FFFFFF;
    }

    .btn-primary,
    .btn-secondary {
        font-weight: bold;
        border: 2px solid currentColor;
    }
}

/* ========================================
   NUEVO: Estilos del Botón de Tema
   ======================================== */
.theme-toggle {
    background: var(--bg-light);
    border: 1px solid var(--gray-light);
    color: var(--dark-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-base);
    margin: 0 var(--spacing-sm);
}

.theme-toggle:hover {
    background: var(--gray-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Ocultar el ícono del sol por defecto */
.theme-toggle .fa-sun {
    display: none;
}

/* Ajuste para el botón de tema en menú móvil */
@media (max-width: 992px) {
    .nav-item-darkmode {
        width: 100%;
        display: flex;
        justify-content: center;
        padding: var(--spacing-md) 0;
        order: -1; /* Pone el botón al inicio del menú móvil */
        border-bottom: 1px solid var(--gray-light);
    }
    .theme-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}


/* ========================================
   MODIFICADO: Dark Mode Support
   Cambiamos de @media a una clase .dark-mode
   ======================================== */
html.dark-mode {
    --bg-light: #2a2a2a;
    --bg-section: #1f1f1f;
    --white: #1a1a1a;
    --dark-color: #f0f0f0;
    --gray-dark: #d0d0d0;
    --gray-medium: #a0a0a0;
    --gray-light: #404040;
}

html.dark-mode body {
    background-color: var(--white);
    color: var(--dark-color);
}

html.dark-mode .header {
    background: #1a1a1a;
    border-bottom: 1px solid #333;
}

html.dark-mode .navbar-menu {
    background: #1a1a1a;
}

html.dark-mode .dropdown-menu {
    background: #1a1a1a;
}

html.dark-mode .service-card,
html.dark-mode .value-card,
html.dark-mode .team-member,
html.dark-mode .contact-form-wrapper,
html.dark-mode .contact-info,
html.dark-mode .vision-box,
html.dark-mode .mission-box,
html.dark-mode .about-section,
html.dark-mode .values-section,
html.dark-mode .products-section,
html.dark-mode .team-section {
    background: #2a2a2a;
}

html.dark-mode .form-control {
    background: #333;
    color: #f0f0f0;
    border-color: #555;
}

/* NUEVO: Estilos del botón en modo oscuro */
html.dark-mode .theme-toggle {
    background: var(--bg-light);
    border-color: var(--gray-light);
    color: var(--dark-color);
}

html.dark-mode .theme-toggle .fa-sun {
    display: block; /* Muestra el sol */
}
html.dark-mode .theme-toggle .fa-moon {
    display: none; /* Oculta la luna */
}


/* ========== Mejoras de Accesibilidad ========== */

/* Focus visible mejorado */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
    top: 0;
}

/* Mejora de contraste para links */
a:focus {
    background-color: rgba(196, 30, 58, 0.1);
}

/* Botones más grandes para touch */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
        padding: 14px 28px;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}
