/* Responsive Design Enhancements for Rafinera Website */
/* This file contains advanced responsive optimizations to improve mobile experience */

/* ===== TOUCH TARGET IMPROVEMENTS ===== */

/* Ensure all interactive elements meet minimum touch target size (44px) */
button,
.btn,
.button,
input[type="submit"],
input[type="button"],
a.button-style,
.footer-submit-button,
.cta-button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    touch-action: manipulation; /* Prevents double-tap zoom */
}

/* Form inputs touch optimization */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 8px;
    touch-action: manipulation;
}

/* Checkbox and radio button touch targets */
input[type="checkbox"],
input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
    margin: 8px;
}

/* Label touch targets for checkboxes/radios */
label {
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* ===== IMPROVED BREAKPOINTS ===== */

/* Extra small devices (phones, 320px and up) */
@media (max-width: 374px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}

/* Small devices (landscape phones, 375px and up) */
@media (min-width: 375px) and (max-width: 767px) {
    .container {
        padding: 15px;
    }
    
    .grid-2-cols {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hero-section {
        padding: 60px 0;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .section-padding {
        padding: 40px 0;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 20px;
    }
    
    .grid-2-cols {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .grid-3-cols {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
    
    .hero-section {
        padding: 80px 0;
    }
    
    .hero-title {
        font-size: 2.8rem;
    }
    
    .section-padding {
        padding: 60px 0;
    }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    .grid-3-cols {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    .grid-4-cols {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    
    .hero-section {
        padding: 100px 0;
    }
    
    .section-padding {
        padding: 80px 0;
    }
}

/* ===== NAVIGATION IMPROVEMENTS ===== */

/* Mobile navigation enhancements */
@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        padding: 12px;
        min-width: 44px;
        min-height: 44px;
        cursor: pointer;
        z-index: 1001;
    }
    
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 1000;
        padding: 80px 20px 20px;
        overflow-y: auto;
    }
    
    .mobile-menu.active {
        left: 0;
    }
    
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-nav-item {
        display: block;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
        font-size: 1.1rem;
        text-decoration: none;
        color: #333;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .mobile-nav-item:hover {
        background: #f5f5f5;
        padding-left: 10px;
    }
}

/* ===== FORM RESPONSIVE IMPROVEMENTS ===== */

/* Form layout improvements */
@media (max-width: 767px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-input {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-submit {
        width: 100%;
        padding: 15px;
        font-size: 1.1rem;
        margin-top: 10px;
    }
    
    .checkbox-group {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
    }
    
    .checkbox-group label {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* ===== IMAGE RESPONSIVE IMPROVEMENTS ===== */

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Hero images */
.hero-image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

@media (max-width: 767px) {
    .hero-image {
        max-height: 300px;
        object-position: center;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hero-image {
        max-height: 400px;
    }
}

/* Feature images */
.feature-image,
.section-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

@media (max-width: 767px) {
    .feature-image,
    .section-image {
        margin-bottom: 20px;
    }
}

/* ===== TEXT READABILITY IMPROVEMENTS ===== */

/* Font size scaling */
@media (max-width: 767px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: 1.6rem;
        line-height: 1.3;
        margin-bottom: 0.8rem;
    }
    
    h3 {
        font-size: 1.3rem;
        line-height: 1.4;
        margin-bottom: 0.6rem;
    }
    
    p {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    .small-text {
        font-size: 0.9rem;
    }
}

/* ===== SPACING IMPROVEMENTS ===== */

/* Section spacing */
@media (max-width: 767px) {
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        margin-bottom: 30px;
    }
    
    .section-content {
        margin-bottom: 25px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .section {
        padding: 60px 0;
    }
    
    .section-title {
        margin-bottom: 40px;
    }
}

/* ===== CARD LAYOUT IMPROVEMENTS ===== */

/* Card responsive behavior */
.card-grid {
    display: grid;
    gap: 20px;
}

@media (max-width: 767px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .card {
        padding: 20px;
        margin-bottom: 15px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .card {
        padding: 25px;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    .card {
        padding: 30px;
    }
}

/* ===== FOOTER RESPONSIVE IMPROVEMENTS ===== */

@media (max-width: 767px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    
    .footer-section {
        margin-bottom: 30px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
    
    /* .footer-link {
        padding: 10px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    } */
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus indicators - removed for clean design */

/* High contrast mode support */
@media (prefers-contrast: high) {
    button,
    .btn {
        border: 2px solid currentColor;
    }
    
    input,
    textarea,
    select {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

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

@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    .no-print {
        display: none !important;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #404040;
    }
    
    body {
        background-color: var(--bg-primary);
        color: var(--text-primary);
    }
    
    .card,
    .section {
        background-color: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    input,
    textarea,
    select {
        background-color: var(--bg-secondary);
        color: var(--text-primary);
        border-color: var(--border-color);
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* GPU acceleration for smooth animations */
.animated-element {
    transform: translateZ(0);
    will-change: transform;
}

/* Optimize repaints */
.scroll-element {
    transform: translate3d(0, 0, 0);
}

/* Container queries support (future-proofing) */
@supports (container-type: inline-size) {
    .responsive-container {
        container-type: inline-size;
    }
    
    @container (max-width: 400px) {
        .container-responsive {
            font-size: 0.9rem;
        }
    }
}