/* ============================================
   TAM MOBİL RESPONSIVE STİLLƏRİ
   Təhlükəsizlik Sistemləri Saytı üçün
============================================ */

/* ===== MOBİL-ÖNCƏLİKLİ YANAŞMA ===== */

/* 1. ÇOX KİÇİK MOBİL (320px - 374px) */
@media (max-width: 374px) {
    :root {
        --space-xs: 0.25rem;
        --space-sm: 0.5rem;
        --space-md: 1rem;
        --space-lg: 2rem;
        --space-xl: 3rem;
    }
    
    html {
        font-size: 13px;
    }
    
    .hero-title {
        font-size: 1.6rem !important;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
        padding: 0 0.5rem;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .product-card {
        margin: 0.5rem;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .product-title {
        font-size: 1rem;
    }
    
    .product-description {
        font-size: 0.8rem;
    }
    
    .feature-tag {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    .nav-container {
        padding: 0 0.75rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .floating-element {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }
    
    .pulse-radar {
        width: 120px !important;
        height: 120px !important;
    }
}

/* 2. KİÇİK MOBİL (375px - 424px) */
@media (min-width: 375px) and (max-width: 424px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .products-container {
        padding: 0 0.75rem;
    }
    
    .product-filters {
        padding: 0.75rem;
    }
}

/* 3. ORTA MOBİL (425px - 575px) */
@media (min-width: 425px) and (max-width: 575px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-buttons a {
        min-width: 180px;
    }
}

/* 4. BÖYÜK MOBİL (576px - 767px) - TABLET PORTRAIT */
@media (min-width: 576px) and (max-width: 767px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-container {
        padding: 0 1.5rem;
    }
    
    .products-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .hero-buttons a {
        width: auto;
        min-width: 200px;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
    
    .product-filters {
        justify-content: center;
        overflow-x: visible;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 0.95rem;
    }
}

/* 5. TABLET LANDSCAPE (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        max-width: 700px;
    }
    
    .hero-visual {
        height: 350px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .products-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 0.95rem;
    }
    
    /* Diagonal sections optimization */
    .diagonal-section::before,
    .diagonal-section::after {
        transform: rotate(-3deg);
    }
}

/* 6. BÖYÜK TABLET (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .hero-container {
        max-width: 960px;
        gap: 3rem;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .products-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nav-menu {
        gap: 1.75rem;
    }
}

/* 7. KİÇİK DESKTOP (1200px - 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .hero-container {
        max-width: 1140px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
}

/* 8. BÖYÜK DESKTOP (1440px+) */
@media (min-width: 1440px) {
    .hero-container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 5rem;
    }
    
    .products-container {
        max-width: 1600px;
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh;
        padding-top: 60px;
    }
    
    .hero-container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-visual {
        height: 250px;
    }
    
    .nav-menu {
        max-height: 60vh;
    }
    
    .products-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-buttons {
        flex-direction: column;
    }
}

/* ===== FOLDABLE DEVICES ===== */
@media (max-width: 767px) and (min-height: 600px) and (max-height: 800px) {
    .hero-section {
        min-height: 80vh;
    }
    
    .hero-container {
        gap: 1.5rem;
    }
    
    .products-section {
        padding: 2rem 0;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Touch device specific styles */
    .product-card:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .btn-primary:hover::before {
        left: -100%;
    }
    
    .btn-primary:active,
    .btn-secondary:active,
    .btn-details:active,
    .btn-quote:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .filter-btn.active {
        transform: scale(1);
    }
    
    .filter-btn:active {
        transform: scale(0.95);
    }
    
    /* Increase touch targets */
    .nav-link,
    .filter-btn,
    .product-card,
    .btn-details,
    .btn-quote {
        cursor: default;
        -webkit-tap-highlight-color: rgba(230, 57, 70, 0.1);
    }
    
    /* Prevent text selection on tap */
    .product-card,
    .btn-primary,
    .btn-secondary {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Hide cursor trail on touch devices */
    .cursor-trail {
        display: none;
    }
}

/* ===== SAFARI IOS SPECIFIC FIXES ===== */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        min-height: -webkit-fill-available;
    }
    
    .navbar {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .nav-menu {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
    
    .hero-buttons {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Fix for iOS bounce effect */
    body {
        overscroll-behavior-y: none;
    }
    
    /* Fix for input zoom */
    input, select, textarea {
        font-size: 16px;
    }
}

/* ===== ANDROID CHROME FIXES ===== */
@media (-webkit-min-device-pixel-ratio: 2) {
    .hero-title,
    .section-title {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        font-weight: 700;
    }
    
    .btn-primary,
    .btn-secondary {
        border-width: 1.5px;
    }
}

/* ===== HIGH-DPI SCREENS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-title,
    .section-title {
        font-weight: 700;
    }
    
    .product-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== DARK MODE PREFERENCE - MOBILE ===== */
@media (prefers-color-scheme: dark) and (max-width: 767px) {
    .navbar {
        background: rgba(10, 10, 10, 0.98);
        border-bottom: 1px solid rgba(230, 57, 70, 0.2);
    }
    
    .nav-menu {
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
    }
    
    .product-card {
        background: rgba(30, 30, 30, 0.8);
        border: 1px solid rgba(230, 57, 70, 0.2);
    }
    
    .filter-btn {
        background: rgba(30, 30, 30, 0.8);
        border: 2px solid rgba(255, 255, 255, 0.1);
        color: var(--text-light);
    }
    
    .filter-btn.active,
    .filter-btn:hover {
        background: var(--primary-red);
        border-color: var(--primary-red);
    }
}

/* ===== LIGHT MODE PREFERENCE - MOBILE ===== */
@media (prefers-color-scheme: light) and (max-width: 767px) {
    .navbar {
        background: rgba(241, 250, 238, 0.98);
        border-bottom: 1px solid rgba(230, 57, 70, 0.1);
    }
    
    .nav-menu {
        background: rgba(241, 250, 238, 0.98);
    }
    
    .nav-link {
        color: var(--text-dark);
        border-bottom: 1px solid rgba(51, 51, 51, 0.1);
    }
    
    .product-card {
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(230, 57, 70, 0.2);
    }
    
    .product-description {
        color: rgba(51, 51, 51, 0.8);
    }
    
    .filter-btn {
        color: var(--text-dark);
        border: 2px solid rgba(51, 51, 51, 0.1);
    }
    
    .feature-tag {
        background: rgba(51, 51, 51, 0.1);
    }
    
    .btn-quote {
        color: var(--text-dark);
        border: 1px solid rgba(51, 51, 51, 0.3);
    }
}

/* ===== REDUCED MOTION PREFERENCE ===== */
@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;
    }
    
    .loading-screen,
    .cursor-trail,
    .speed-lines,
    .floating-element,
    .pulse-radar,
    .scroll-indicator {
        display: none;
    }
    
    .text-reveal span {
        animation: none;
        transform: translateY(0);
        opacity: 1;
    }
    
    .rotating-text {
        animation: none;
        opacity: 1;
        position: static;
    }
    
    .grid-lines {
        animation: none;
    }
    
    .pulse-btn {
        animation: none;
    }
    
    .typewriter-cursor {
        animation: none;
        opacity: 1;
    }
    
    /* Mobile specific reduced motion */
    @media (max-width: 767px) {
        .hero-section,
        .products-section,
        .product-card,
        .btn-primary,
        .btn-secondary {
            transition: none;
            animation: none;
        }
        
        .floating-element,
        .pulse-radar,
        .grid-lines,
        .speed-lines {
            animation: none;
            display: none;
        }
        
        .scroll-indicator {
            animation: none;
        }
        
        .loading-screen {
            animation: none;
        }
    }
}

/* ===== DATA SAVER MODE ===== */
@media (prefers-reduced-data: reduce) {
    .hero-visual {
        background: none;
    }
    
    .speed-lines {
        display: none;
    }
    
    .product-image {
        loading: lazy;
    }
    
    /* Mobile specific data saving */
    @media (max-width: 767px) {
        .hero-visual {
            display: none;
        }
        
        .floating-element {
            display: none;
        }
        
        .product-image {
            max-width: 100%;
            height: auto;
        }
    }
}

/* ===== MOBILE SPECIFIC UTILITY CLASSES ===== */
@media (max-width: 767px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-show {
        display: block !important;
    }
    
    .mobile-stack {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .mobile-grid-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .mobile-grid-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    /* Swipeable containers */
    .swipe-container {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 1rem;
        padding: 1rem 0;
        margin: 0 -1rem;
        padding-left: 1rem;
    }
    
    .swipe-container::-webkit-scrollbar {
        display: none;
    }
    
    .swipe-slide {
        flex: 0 0 auto;
        width: 85%;
        scroll-snap-align: start;
    }
    
    /* Safe area insets */
    .safe-area-top {
        padding-top: env(safe-area-inset-top);
    }
    
    .safe-area-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .safe-area-left {
        padding-left: env(safe-area-inset-left);
    }
    
    .safe-area-right {
        padding-right: env(safe-area-inset-right);
    }
    
    /* Touch feedback classes */
    .touch-active {
        opacity: 0.7;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    /* Performance optimization classes */
    .reduce-animations * {
        animation: none !important;
        transition: none !important;
    }
}

/* ===== TABLET UTILITY CLASSES ===== */
@media (min-width: 768px) and (max-width: 991px) {
    .tablet-only {
        display: block !important;
    }
    
    .tablet-hide {
        display: none !important;
    }
    
    .tablet-grid-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* ===== DESKTOP UTILITY CLASSES ===== */
@media (min-width: 992px) {
    .desktop-only {
        display: block !important;
    }
    
    .mobile-only {
        display: none !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .hero-buttons,
    .product-filters,
    .scroll-indicator,
    .loading-screen {
        display: none !important;
    }
    
    .hero-section,
    .products-section {
        padding: 0 !important;
        min-height: auto !important;
    }
    
    .hero-container {
        grid-template-columns: 1fr !important;
        text-align: left !important;
    }
    
    .products-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    body {
        color: #000 !important;
        background: #fff !important;
        font-size: 12pt !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}

/* ===== EMERGENCY MOBILE FIXES ===== */
/* These fix common mobile issues that might not be caught above */

/* Fix for 100vh on mobile */
html, body {
    height: 100%;
    overflow-x: hidden;
}

/* Prevent horizontal scroll */
.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Fix for iOS form elements */
input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

/* Fix for sticky hover on mobile */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover .card-inner {
        transform: none !important;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none !important;
    }
}

/* Fix for font rendering on mobile */
body {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fix for image loading */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Fix for tap delay on mobile */
a, button, input, select, textarea {
    touch-action: manipulation;
}

/* Fix for momentum scrolling on iOS */
.products-container,
.nav-menu {
    -webkit-overflow-scrolling: touch;
}

/* Fix for viewport units on mobile */
.hero-section {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* Fix for modal on mobile */
.quote-modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix for sticky elements on iOS */
.navbar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
}

/* Fix for background-attachment on mobile */
@media (max-width: 767px) {
    .hero-section {
        background-attachment: scroll !important;
    }
}

/* Fix for flexbox gap on older mobile browsers */
@supports not (gap: 1rem) {
    .hero-buttons > * + * {
        margin-left: 1rem;
    }
    
    .product-filters > * + * {
        margin-left: 1rem;
    }
    
    .product-features > * + * {
        margin-left: 0.5rem;
    }
    
    @media (max-width: 767px) {
        .hero-buttons > * + * {
            margin-left: 0;
            margin-top: 1rem;
        }
    }
}

/* Fix for CSS Grid on older mobile browsers */
@supports not (display: grid) {
    .products-container {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .product-card {
        flex: 1 1 300px;
        max-width: 100%;
    }
    
    @media (max-width: 767px) {
        .product-card {
            flex: 1 1 100%;
        }
    }
}

/* ===== PERFORMANCE OPTIMIZATION CLASSES ===== */
.perf-optimize {
    /* Will-change for performance */
    will-change: transform, opacity;
    
    /* Promote to GPU layer */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Optimize images for mobile */
.product-image {
    loading: lazy;
    decoding: async;
    fetchpriority: low;
}

/* Optimize critical images */
.hero-visual {
    fetchpriority: high;
}

/* ===== ACCESSIBILITY FOR MOBILE ===== */
@media (max-width: 767px) {
    /* Increase font size for better readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    /* Better contrast for mobile */
    .btn-primary,
    .btn-secondary {
        color: white;
    }
    
    /* Larger hit areas for accessibility */
    .nav-link {
        padding: 1rem;
        margin: 0.25rem 0;
    }
    
    /* Better focus indicators */
    .btn-primary:focus,
    .btn-secondary:focus,
    .btn-details:focus,
    .btn-quote:focus,
    .filter-btn:focus,
    .nav-link:focus {
        outline: 3px solid var(--primary-red);
        outline-offset: 2px;
    }
    
    /* Hide decorative elements from screen readers */
    .speed-lines,
    .cursor-trail,
    .grid-lines {
        aria-hidden: "true";
    }
}

/* ===== ANIMATION PERFORMANCE OPTIMIZATION ===== */
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
    /* Only enable smooth animations on capable devices */
    @media (min-width: 375px) and (min-height: 667px) {
        .product-card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .btn-primary,
        .btn-secondary {
            transition: all 0.3s ease;
        }
    }
}

/* ===== BATTERY SAVING MODE DETECTION ===== */
@media (max-width: 767px) {
    /* Reduce animations when battery is low */
    .low-battery-mode .floating-element,
    .low-battery-mode .speed-lines,
    .low-battery-mode .pulse-radar {
        animation: none;
        opacity: 0.5;
    }
    
    .low-battery-mode .product-card:hover {
        transform: none;
    }
}
/* responsive.css içine ekleyin */

/* iPhone X/11/12/13/14/15 */
@media only screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3),
       only screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3),
       only screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) {
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .projects-container {
        padding: 0 1rem;
    }
    
    .project-card {
        margin: 0.5rem;
    }
}

/* iPhone SE ve küçük ekranlar */
@media only screen and (max-width: 375px) {
    .logo-text {
        font-size: 1.2rem;
    }
    
    .hero-buttons .btn-primary,
    .hero-buttons .btn-secondary {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .partner-logos {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .partner-logo {
        font-size: 0.8rem;
        padding: 4px 8px;
        margin: 2px;
    }
}

/* Landscape mod için */
@media only screen and (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 150vh;
    }
    
    .hero-container {
        flex-direction: row;
        align-items: center;
    }
    
    .nav-menu {
        max-height: 80vh;
        overflow-y: auto;
    }
}