/**
 * TRESTINI FRUIT WEBSITE
 * Responsive CSS - Mobile First Approach
 */

/* ========================================================================
   MOBILE FIRST - BASE STYLES (320px+)
   ======================================================================== */

/* Prevent horizontal scrolling */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Typography adjustments for mobile */
h1 {
    font-size: 2.2rem;
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.4rem;
}

/* Hero responsive styles - mobile first */
.hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--spacing-lg);
}

.hero-logo {
    width: 250px;
    height: 250px;
}

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

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

/* Container padding for mobile */
.container {
    padding: 0 var(--spacing-sm);
    max-width: 100%;
    box-sizing: border-box;
}

.section {
    padding: var(--spacing-lg) 0;
}

/* Mobile specific spacing adjustments */
.hero-cta {
    margin-top: var(--spacing-md);
    justify-content: center;
    align-items: center;
}

.hero-cta .btn {
    width: auto;
    min-width: 180px;
    flex: 1;
    max-width: 250px;
}

@media (max-width: 480px) {
    .hero-cta {
        flex-direction: column;
        gap: var(--spacing-sm) !important;
        width: 100%;
    }
    
    .hero-cta .btn {
        width: 100%;
        max-width: none;
        flex: none;
    }
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .navbar-toggle {
        display: flex;
        order: 3;
    }
    
    .language-switcher {
        order: 2;
        margin-left: auto;
        margin-right: var(--spacing-sm);
        position: relative;
        z-index: 1001;
    }
    
    .language-switcher .lang-link,
    .language-switcher .lang-current {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .navbar .container {
        flex-wrap: nowrap;
    }
    
    .navbar-menu {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background-color: var(--bianco);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: var(--spacing-lg);
        box-shadow: var(--box-shadow);
        transition: var(--transition);
        z-index: 999;
        order: 4;
    }
    
    .navbar-menu.active {
        left: 0;
    }
    
    .navbar-nav {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }
    
    .nav-item {
        width: 100%;
        margin: var(--spacing-xs) 0;
    }
    
    .nav-link {
        display: block;
        padding: var(--spacing-sm);
        text-align: center;
        border-bottom: 1px solid var(--grigio-chiaro);
        font-size: 1.1rem;
    }
    
    .navbar-menu .language-switcher {
        margin: var(--spacing-lg) 0;
        padding-top: var(--spacing-lg);
        border-top: 1px solid var(--grigio-chiaro);
        justify-content: center;
        width: 100%;
    }
    
    .navbar-menu .lang-link,
    .navbar-menu .lang-current {
        padding: 12px 16px;
        margin: 0 4px;
        font-size: 16px;
        min-height: 44px;
    }
    
    /* Hamburger animation */
    .navbar-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .navbar-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    
    .navbar-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

/* Hero section mobile */
.hero {
    height: auto;
    min-height: 70vh;
    padding: var(--spacing-xl) 0;
}

.hero-content {
    padding: 0 var(--spacing-sm);
    gap: var(--spacing-md);
    text-align: center;
}

.hero-title {
    font-size: 2.2rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

.hero-logo {
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

/* Grid adjustments for mobile */
.about-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}

.products-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

.services-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

.footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    text-align: center;
}

.footer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-info {
    width: 100%;
    text-align: center;
}

.language-switcher-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
}

.footer-bottom-content {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
}

.footer-links-bottom {
    justify-content: center;
}

/* Form adjustments for mobile */
.btn {
    width: 100%;
    margin-bottom: var(--spacing-sm);
}

/* Back to top button mobile */
.back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
}

/* ========================================================================
   SMALL TABLETS (576px+)
   ======================================================================== */
@media (min-width: 576px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .btn {
        width: auto;
        margin-bottom: 0;
    }
}

/* ========================================================================
   TABLETS (768px+)
   ======================================================================== */
@media (min-width: 768px) {
    /* Hero desktop styles */
    .hero-content {
        grid-template-columns: 1fr 1fr;
        text-align: left;
    }
    
    .hero-logo {
        width: 400px;
        height: 400px;
    }
    
    .navbar-toggle {
        display: none;
    }
    
    .navbar-menu {
        position: static;
        height: auto;
        width: auto;
        background: none;
        box-shadow: none;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        padding: 0;
    }
    
    .navbar-nav {
        flex-direction: row;
        width: auto;
    }
    
    .nav-item {
        width: auto;
        margin: 0 var(--spacing-sm);
    }
    
    .nav-link {
        padding: 10px 0;
        border-bottom: none;
        font-size: 16px;
    }
    
    .language-switcher {
        margin: 0 0 0 var(--spacing-md);
        padding: 0;
        border: none;
    }
    
    .hero {
        height: 100vh;
        min-height: 600px;
        padding: 0;
    }
    
    .hero-title {
        font-size: 3.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    .hero-logo {
        width: 350px;
        height: 350px;
    }
    
    h1 {
        font-size: 3rem;
    }
    
    h2 {
        font-size: 2.2rem;
    }
    
    .about-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xxl);
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: var(--spacing-lg);
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: var(--spacing-lg);
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        text-align: left;
    }
    
    .footer-section {
        align-items: flex-start;
    }
    
    .contact-info {
        text-align: left;
    }
    
    .language-switcher-footer {
        text-align: left;
    }
    
    .footer-bottom-content {
        flex-direction: row;
        text-align: left;
    }
    
    .section {
        padding: var(--spacing-xxl) 0;
    }
}

/* ========================================================================
   LAPTOPS (992px+)
   ======================================================================== */
@media (min-width: 992px) {
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
    
    h1 {
        font-size: 3rem;
    }
    
    h2 {
        font-size: 2.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .container {
        padding: 0 var(--spacing-lg);
    }
}

/* ========================================================================
   DESKTOPS (1200px+)
   ======================================================================== */
@media (min-width: 1200px) {
    .hero-title {
        font-size: 4.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.6rem;
    }
    
    .container {
        padding: 0 var(--spacing-xl);
    }
}

/* ========================================================================
   LARGE SCREENS (1400px+)
   ======================================================================== */
@media (min-width: 1400px) {
    :root {
        --container-max-width: 1400px;
    }
    
    .hero-title {
        font-size: 5rem;
    }
    
    .hero-subtitle {
        font-size: 1.8rem;
    }
}

/* ========================================================================
   ACCESSIBILITY & REDUCED MOTION
   ======================================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================================================
   PRINT STYLES
   ======================================================================== */
@media print {
    .header,
    .footer,
    .back-to-top,
    .navbar-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0 !important;
    }
    
    .hero {
        height: auto;
        min-height: auto;
        padding: var(--spacing-lg) 0;
        background: none !important;
        color: var(--nero) !important;
    }
    
    .section {
        page-break-inside: avoid;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    .btn {
        border: 2px solid var(--nero);
        background: none !important;
        color: var(--nero) !important;
    }
}

/* ========================================================================
   HIGH CONTRAST MODE
   ======================================================================== */
@media (prefers-contrast: high) {
    :root {
        --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border-width: 3px;
    }
    
    .nav-link::after {
        height: 3px;
    }
}

/* ========================================================================
   DARK MODE SUPPORT (Future implementation)
   ======================================================================== */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here in future */
    /* Currently not implemented as per requirements */
}

/* ========================================================================
   LANDSCAPE ORIENTATION (MOBILE)
   ======================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: 100vh;
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section {
        padding: var(--spacing-md) 0;
    }
}

/* ========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================================================== */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 14px 30px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .lang-link,
    .lang-current {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .navbar-toggle {
        min-height: 44px;
        min-width: 44px;
        padding: 10px;
    }
    
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Remove hover effects on touch devices */
    .product-card:hover,
    .service-card:hover,
    .about-image:hover img {
        transform: none;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-outline:hover {
        transform: none;
    }
}