/* ===================================
   APACO Website - Responsive Styles
   =================================== */

/* Tablet Styles */
@media (max-width: 1024px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    
    .container {
        padding: 0 30px;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .about-content {
        gap: 3rem;
    }
    
    .program-card {
        gap: 2rem;
    }
    
    .program-image img {
        min-height: 250px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Typography - Better readability */
    body {
        font-size: 16px;
        line-height: 1.7;
    }
    
    h1 { 
        font-size: 2rem;
        line-height: 1.3;
    }
    
    h2 { 
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    h3 { 
        font-size: 1.4rem;
        line-height: 1.4;
    }
    
    p {
        margin-bottom: 1.2rem;
    }
    
    /* Container - More breathing room */
    .container {
        padding: 0 24px;
    }
    
    /* Navigation - Improved mobile menu */
    .navbar {
        padding: 0;
    }
    
    .nav-wrapper {
        padding: 1rem 0;
    }
    
    .logo h2 {
        font-size: 1.5rem;
    }
    
    .logo-subtitle {
        font-size: 0.7rem;
    }
    
    .nav-toggle {
        display: flex;
        padding: 10px;
        /* Bigger touch target */
        margin: -10px -10px -10px 10px;
        z-index: 1002;
        position: relative;
    }
    
    .nav-toggle span {
        width: 28px;
        height: 3px;
    }
    
    /* Mobile menu backdrop */
    .nav-menu::before {
        content: '';
        position: fixed;
        top: 70px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 70px);
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: -1;
    }
    
    .nav-menu.active::before {
        opacity: 1;
        visibility: visible;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 100%;
        max-width: 320px;
        height: calc(100vh - 70px);
        background: var(--white);
        flex-direction: column;
        padding: 2.5rem 2rem;
        box-shadow: -5px 0 25px var(--shadow);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        gap: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1001;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu li {
        width: 100%;
        margin-bottom: 0;
    }
    
    .nav-menu a {
        display: block;
        padding: 1rem 0;
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        /* Better touch target */
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .nav-menu li:last-child a {
        border-bottom: none;
    }
    
    .btn-contact {
        margin-top: 1rem;
        justify-content: center;
        padding: 12px 28px;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px);
    }
    
    /* Hero - Better mobile experience */
    .hero {
        min-height: 520px;
        height: 100vh;
        max-height: 800px;
    }
    
    .hero-content {
        padding: 0 20px;
    }
    
    .hero-title {
        font-size: 2.25rem;
        margin-bottom: 1rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
        line-height: 1.5;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 280px;
        padding: 15px 32px;
        font-size: 1rem;
        /* Better touch target */
        min-height: 50px;
    }
    
    /* Stats - Comfortable spacing */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 2rem 0;
    }
    
    .stat-item {
        padding: 2rem 1.5rem;
        text-align: center;
    }
    
    .stat-item i {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
        margin: 0.5rem 0;
    }
    
    .stat-label {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* Sections - More breathing room */
    section {
        padding: 4rem 0;
    }
    
    .section-header {
        margin-bottom: 3rem;
        padding: 0 10px;
    }
    
    .section-tag {
        font-size: 0.85rem;
        padding: 8px 20px;
        margin-bottom: 1rem;
    }
    
    .section-description {
        font-size: 1rem;
        line-height: 1.6;
        margin-top: 1rem;
    }
    
    /* About Preview - Better layout */
    .about-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .about-text {
        padding: 0 10px;
    }
    
    .about-text p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1.2rem;
    }
    
    .about-image {
        margin-top: 1rem;
    }
    
    .about-image img {
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }
    
    /* Products - Card layout */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 10px;
    }
    
    .product-card {
        padding: 2.5rem 2rem;
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .product-icon {
        margin-bottom: 1.5rem;
    }
    
    .product-icon i {
        font-size: 2.5rem;
    }
    
    .product-card h3 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .product-card p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .products-hero {
        margin-bottom: 3rem;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .products-cta {
        margin-top: 3rem;
        text-align: center;
    }
    
    /* Programs - Better mobile cards */
    .programs-grid {
        gap: 2.5rem;
    }
    
    .program-card {
        grid-template-columns: 1fr;
        gap: 0;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .program-card:nth-child(even) {
        direction: ltr;
    }
    
    .program-image img {
        min-height: 220px;
        object-fit: cover;
    }
    
    .program-content {
        padding: 2rem 1.5rem;
    }
    
    .program-content h3 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    
    .program-content p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .programs-cta {
        margin-top: 3rem;
        text-align: center;
    }
    
    /* Gallery - Better image viewing */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 10px;
    }
    
    .gallery-item {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    /* CTA Section - Comfortable padding */
    .cta-section {
        padding: 3.5rem 0;
    }
    
    .cta-content {
        padding: 0 15px;
        text-align: center;
    }
    
    .cta-content h2 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1.2rem;
    }
    
    .cta-content p {
        font-size: 1.05rem;
        line-height: 1.6;
        margin-bottom: 2rem;
    }
    
    .cta-content .btn {
        padding: 15px 40px;
        font-size: 1.05rem;
        min-height: 50px;
    }
    
    /* Footer - Better mobile layout */
    .footer {
        padding: 3.5rem 0 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .footer-section {
        text-align: left;
        padding: 0 10px;
    }
    
    .footer-section h3 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .footer-section h4 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .footer-section p,
    .footer-section a {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .footer-section ul li {
        margin-bottom: 0.8rem;
    }
    
    .footer-bottom {
        margin-top: 2.5rem;
        padding-top: 2rem;
        font-size: 0.95rem;
    }
    
    /* Forms - Better touch experience */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 16px;
        border-radius: 8px;
        min-height: 50px;
    }
    
    textarea {
        min-height: 150px;
    }
    
    button[type="submit"],
    input[type="submit"] {
        font-size: 1.05rem;
        padding: 15px 32px;
        min-height: 50px;
        border-radius: 50px;
    }
    
    /* Tables - Horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Images - Prevent overflow */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Small Mobile - Extra small screens */
@media (max-width: 480px) {
    /* Even more comfortable spacing */
    .container {
        padding: 0 20px;
    }
    
    /* Typography adjustments */
    h1 { 
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    h2 { 
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    /* Hero */
    .hero-title {
        font-size: 1.85rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .hero-buttons .btn {
        max-width: 100%;
        width: 100%;
    }
    
    /* Stats - Single column for clarity */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Buttons - Full width on tiny screens */
    .btn {
        padding: 14px 28px;
        font-size: 1rem;
        min-height: 48px;
    }
    
    /* Product cards */
    .product-card {
        padding: 2rem 1.5rem;
    }
    
    .product-icon i {
        font-size: 2.2rem;
    }
    
    /* Section tags */
    .section-tag {
        font-size: 0.8rem;
        padding: 6px 16px;
    }
    
    /* Navigation adjustments */
    .logo h2 {
        font-size: 1.3rem;
    }
    
    .logo-subtitle {
        font-size: 0.65rem;
    }
    
    .nav-menu {
        max-width: 100%;
        padding: 2rem 1.5rem;
    }
    
    /* Footer */
    .footer-section {
        padding: 0 5px;
    }
    
    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        padding: 12px 14px;
    }
}

/* Landscape Mobile - Horizontal phones */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 450px;
        padding: 100px 0 50px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-buttons .btn {
        max-width: 200px;
    }
    
    /* Stats in landscape */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

/* Accessibility improvements for all mobile devices */
@media (max-width: 768px) {
    /* Better focus states for keyboard navigation */
    a:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid var(--accent-gold);
        outline-offset: 2px;
    }
    
    /* Prevent text selection on buttons */
    button,
    .btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        user-select: none;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
}

/* High DPI screens optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-image img,
    .product-card img,
    .program-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
