/* =========================================
   CODEIA SOLUTIONS - RESPONSIVE DESIGN
   ========================================= */

/* Breakpoints */
/* Mobile: 320px - 768px */
/* Tablet: 768px - 1024px */
/* Desktop: 1024px+ */

/* =========================================
   TABLET STYLES (768px - 1024px)
   ========================================= */

@media (max-width: 1024px) {
    /* Container adjustments */
    .container {
        padding: 0 1.5rem;
    }

    /* Navigation */
    .nav-container {
        padding: 0 1.5rem;
    }

    .nav-menu {
        gap: 1.5rem;
    }

    /* Hero Section */
    .hero-content {
        gap: 3rem;
        padding: 0 1.5rem;
    }

    .hero-text h1 {
        font-size: 3rem;
        line-height: 1.1;
    }

    .hero-text p {
        font-size: 1.2rem;
    }

    .code-animation {
        padding: 1.5rem;
    }

    .code-lines {
        font-size: 0.8rem;
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }

    .service-card {
        padding: 2rem;
    }

    .service-icon {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }

    /* About Section */
    .about-content {
        gap: 3rem;
    }

    .stats {
        gap: 1rem;
    }

    .stat-item {
        padding: 1rem;
    }

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

    .tech-stack {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
        max-width: 280px;
    }

    .tech-item {
        padding: 0.8rem;
        font-size: 0.8rem;
    }

    /* Portfolio Grid */
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    .portfolio-image {
        height: 180px;
        font-size: 2.5rem;
    }

    /* Contact Section */
    .contact-content {
        gap: 3rem;
    }

    .contact-info h2 {
        font-size: 2.2rem;
    }

    .contact-info p {
        font-size: 1rem;
    }

    .contact-form {
        padding: 1.5rem;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    /* Certifications */
    .cert-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1.5rem;
    }

    .cert-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

/* =========================================
   MOBILE STYLES (320px - 768px)
   ========================================= */

@media (max-width: 768px) {
    /* Base adjustments */
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 1rem;
    }

    /* Navigation Mobile */
    .nav-container {
        padding: 0 1rem;
    }

    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 2rem 0;
        transition: left 0.3s ease;
        z-index: 999;
        gap: 1rem;
    }

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

    .nav-link {
        font-size: 1.2rem;
        padding: 1rem 0;
        width: 80%;
        text-align: center;
        border-bottom: 1px solid rgba(124, 179, 66, 0.2);
    }

    .mobile-menu {
        display: flex;
    }

    .mobile-menu.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .mobile-menu.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    .logo {
        font-size: 1.3rem;
        gap: 10px;
    }

    .logo-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    /* Hero Section Mobile */
    .hero {
        min-height: 90vh;
        padding: 80px 0 0;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
        padding: 0 1rem;
    }

    .hero-text h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }

    .hero-text p {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .code-animation {
        padding: 1rem;
        margin: 0 1rem;
    }

    .code-lines {
        font-size: 0.7rem;
        line-height: 1.6;
    }

    /* Services Section Mobile */
    .services {
        padding: 3rem 0;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .section-header h2 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .section-header p {
        font-size: 1rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .service-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .service-card h3 {
        font-size: 1.3rem;
    }

    .service-card p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .service-features {
        margin-top: 1rem;
    }

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

    /* About Section Mobile */
    .about {
        padding: 3rem 0;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .about-text h2 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .about-text p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }

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

    .stat-item {
        padding: 1rem 0.5rem;
    }

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

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

    .tech-stack {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        max-width: 200px;
        margin: 0 auto;
    }

    .tech-item {
        padding: 0.6rem;
        font-size: 0.7rem;
    }

    /* Portfolio Section Mobile */
    .portfolio {
        padding: 3rem 0;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .portfolio-item {
        margin: 0 0.5rem;
    }

    .portfolio-image {
        height: 150px;
        font-size: 2rem;
    }

    .portfolio-content {
        padding: 1rem;
    }

    .portfolio-content h3 {
        font-size: 1.1rem;
    }

    .portfolio-content p {
        font-size: 0.8rem;
        line-height: 1.5;
    }

    /* Certifications Mobile */
    .certifications {
        padding: 2rem 0;
    }

    .cert-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .cert-item {
        padding: 0.5rem;
    }

    .cert-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .cert-item h4 {
        font-size: 0.8rem;
    }

    .cert-item p {
        font-size: 0.7rem;
    }

    /* Contact Section Mobile */
    .contact {
        padding: 3rem 0;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-info {
        text-align: center;
    }

    .contact-info h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .contact-info p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .contact-details {
        margin-bottom: 1.5rem;
    }

    .contact-details li {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
        justify-content: center;
    }

    .contact-form {
        padding: 1rem;
        margin: 0 0.5rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

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

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

    .social-links {
        justify-content: center;
    }

    .social-links a {
        width: 35px;
        height: 35px;
    }

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

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .footer-section p,
    .footer-section a {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .footer-bottom {
        padding-top: 1.5rem;
        font-size: 0.8rem;
    }

    /* Floating Elements Mobile */
    .floating-buttons {
        right: 10px;
        bottom: 20px;
        gap: 10px;
    }

    .floating-buttons-left {
        left: 10px;
        bottom: 20px;
    }

    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .floating-btn-tooltip {
        display: none !important;
    }

    /* Chat Widget Mobile */
    .chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 10px;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-header-info h4 {
        font-size: 0.9rem;
    }

    .chat-header-info span {
        font-size: 0.7rem;
    }

    .chat-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .chat-body {
        height: calc(100vh - 250px);
        padding: 15px;
    }

    .message-bubble {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .message-time {
        font-size: 0.6rem;
    }

    .chat-option {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 20px;
    }

    .chat-footer {
        padding: 12px 15px;
    }

    .chat-input {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .chat-send {
        width: 35px;
        height: 35px;
    }
}

/* =========================================
   SMALL MOBILE (320px - 480px)
   ========================================= */

@media (max-width: 480px) {
    /* Extra small adjustments */
    .container {
        padding: 0 0.8rem;
    }

    .hero-text h1 {
        font-size: 1.8rem;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.6rem;
    }

    .service-card {
        margin: 0;
        padding: 1.2rem;
    }

    .service-card h3 {
        font-size: 1.2rem;
    }

    .about-text h2 {
        font-size: 1.6rem;
    }

    .contact-info h2 {
        font-size: 1.5rem;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .tech-stack {
        grid-template-columns: 1fr;
        max-width: 150px;
    }

    .cert-grid {
        grid-template-columns: 1fr;
    }

    .cert-item {
        padding: 1rem;
    }

    .chat-widget {
        width: calc(100vw - 10px);
        right: 5px;
        bottom: 70px;
    }

    .floating-buttons {
        right: 5px;
        bottom: 10px;
    }

    .floating-buttons-left {
        left: 5px;
        bottom: 10px;
    }
}

/* =========================================
   LANDSCAPE MOBILE
   ========================================= */

@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 60px 0 0;
    }

    .hero-content {
        padding: 1rem;
    }

    .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 0.8rem;
    }

    .hero-text p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .cta-buttons {
        flex-direction: row;
        gap: 1rem;
    }

    .btn {
        width: auto;
        padding: 0.6rem 1.2rem;
    }

    .chat-widget {
        height: calc(100vh - 80px);
        bottom: 60px;
    }

    .nav-menu {
        height: calc(100vh - 60px);
        top: 60px;
    }
}

/* =========================================
   HIGH DPI DISPLAYS
   ========================================= */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimizaciones para pantallas retina */
    .logo-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .service-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* =========================================
   PRINT STYLES
   ========================================= */

@media print {
    /* Ocultar elementos no necesarios para impresión */
    .navbar,
    .floating-buttons,
    .floating-buttons-left,
    .chat-widget,
    .cta-buttons,
    .social-links {
        display: none !important;
    }

    /* Ajustar colores para impresión */
    .hero,
    .contact,
    .footer {
        background: white !important;
        color: black !important;
    }

    .hero-text {
        color: black !important;
    }

    /* Optimizar espaciado para impresión */
    .hero,
    .services,
    .about,
    .portfolio,
    .contact {
        padding: 1rem 0 !important;
    }

    /* Forzar saltos de página */
    .services,
    .about,
    .portfolio {
        page-break-before: always;
    }
}

/* =========================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================= */

/* Focus visible para navegación por teclado */
@media (max-width: 768px) {
    .nav-link:focus,
    .btn:focus,
    .floating-btn:focus,
    .chat-option:focus,
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        outline: 2px solid var(--light-green);
        outline-offset: 2px;
    }

    /* Mejorar tap targets para touch */
    .nav-link,
    .btn,
    .floating-btn,
    .chat-option,
    .social-links a {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* =========================================
   UTILITIES RESPONSIVE
   ========================================= */

/* Show/Hide utilities */
.show-mobile {
    display: none;
}

.show-tablet {
    display: none;
}

.show-desktop {
    display: block;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .show-desktop {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
    
    .show-tablet {
        display: block !important;
    }
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Text alignment utilities */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
}

/* Spacing utilities for mobile */
@media (max-width: 768px) {
    .mt-mobile-0 { margin-top: 0 !important; }
    .mt-mobile-1 { margin-top: 0.5rem !important; }
    .mt-mobile-2 { margin-top: 1rem !important; }
    .mt-mobile-3 { margin-top: 1.5rem !important; }
    
    .mb-mobile-0 { margin-bottom: 0 !important; }
    .mb-mobile-1 { margin-bottom: 0.5rem !important; }
    .mb-mobile-2 { margin-bottom: 1rem !important; }
    .mb-mobile-3 { margin-bottom: 1.5rem !important; }
    
    .p-mobile-0 { padding: 0 !important; }
    .p-mobile-1 { padding: 0.5rem !important; }
    .p-mobile-2 { padding: 1rem !important; }
    .p-mobile-3 { padding: 1.5rem !important; }
}

/* --- Responsive Dropdown Menu --- */
@media (max-width: 1024px) {
    .nav-menu .has-dropdown .dropdown-menu {
        position: static;
        display: none;
        width: 100%;
        background-color: rgba(0,0,0,0.05);
        box-shadow: none;
        padding: 0.5rem 0 0.5rem 2rem;
        margin-top: 0.5rem;
        border-radius: 10px;
        grid-template-columns: 1fr;
        max-height: 300px; /* Changed from height: 0; */
        opacity: 0;
        overflow-y: auto; /* Changed from overflow: hidden; */
        transition: max-height 0.3s ease, opacity 0.3s ease; /* Changed transition property */
    }

    .nav-menu .has-dropdown.active .dropdown-menu {
        display: grid;
        opacity: 1;
    }

    .nav-menu .has-dropdown .dropdown-column {
        padding: 0;
    }

    .nav-menu .has-dropdown .dropdown-column h4 {
        font-size: 0.9rem;
        color: var(--primary-green);
        margin-bottom: 0.5rem;
        border: none;
    }

    .nav-menu .has-dropdown .dropdown-column ul li a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.6rem 0;
        font-size: 0.9rem;
    }
    
    .nav-menu .has-dropdown .dropdown-column ul li a i {
        min-width: 20px; /* Changed from fixed width to min-width */
        text-align: center;
        color: var(--primary-green);
    }

    .nav-link .fa-chevron-down {
        transition: transform 0.3s ease;
    }
}