/* ========================================
   RESPONSIVE STYLES - Mobile First Approach
   All screen sizes from 320px to 4K
======================================== */

/* ========================================
   EXTRA LARGE SCREENS (1400px+)
======================================== */
@media (min-width: 1400px) {
    .container-wide {
        padding: 0 60px;
    }
    
    .hero-container {
        gap: 80px;
    }
}

/* ========================================
   LARGE SCREENS (1200px - 1399px)
======================================== */
@media (max-width: 1399px) {
    .hero-title {
        font-size: 2.8rem;
    }
    
    .footer-inner {
        gap: 30px;
    }
}

/* ========================================
   MEDIUM-LARGE (992px - 1199px)
======================================== */
@media (max-width: 1199px) {
    :root {
        --apt-header-height: 85px;
    }
    
    .header-inner {
        gap: 15px;
    }
    
    .nav-menu > li > a {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .categories-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .hero-container {
        gap: 40px;
    }
    
    .hero-search-box {
        max-width: 650px;
    }
    
    .hero-stats {
        gap: 30px;
    }
    
    .footer-inner {
        grid-template-columns: 1.5fr repeat(3, 1fr);
    }
}

/* ========================================
   TABLETS (768px - 991px)
======================================== */
@media (max-width: 991px) {
    :root {
        --apt-header-height: 70px;
    }
    
    /* Header Mobile Layout */
    .menu-toggle {
        display: flex;
    }
    
    .categories-btn {
        display: none;
    }
    
    .main-navigation {
        position: fixed;
        top: var(--apt-header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--apt-primary-dark);
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px;
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--apt-transition);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 999;
    }
    
    .main-navigation.active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }
    
    .nav-menu > li {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-menu > li > a {
        padding: 15px 0;
        font-size: 1rem;
        justify-content: space-between;
    }
    
    .nav-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255,255,255,0.05);
        margin: 0;
        border-radius: 0;
        padding: 0;
        display: none;
    }
    
    .nav-menu > li.submenu-open .sub-menu {
        display: block;
    }
    
    .nav-menu .sub-menu li a {
        color: rgba(255,255,255,0.8);
        padding: 12px 20px;
    }
    
    .nav-menu .sub-menu li a:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }
    
    .user-name {
        display: none;
    }
    
    /* Hero */
    .hero-section {
        min-height: auto;
        padding: 50px 0 60px;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 0 20px;
    }
    
    .hero-subtitle {
        margin: 0 auto 30px;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .hero-visual {
        display: none;
    }
    
    .hero-search-box {
        border-radius: 12px;
        padding: 10px;
        max-width: 100%;
    }
    
    .hero-search-form {
        flex-wrap: wrap;
    }
    
    .search-field {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
    }
    
    .search-field.field-input {
        flex: 100%;
    }
    
    .search-field.field-select {
        flex: 1;
        min-width: 0;
    }
    
    .search-field.field-select:last-of-type {
        border-bottom: none;
    }
    
    .search-field input,
    .search-field select {
        height: 48px;
    }
    
    .search-submit-btn {
        width: 100%;
        margin: 8px 4px 4px;
    }
    
    /* Sections */
    .section {
        padding: 50px 0;
    }
    
    .container-wide {
        padding: 0 20px;
    }
    
    /* Footer */
    .footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .footer-about {
        grid-column: 1 / -1;
        text-align: center;
    }
    
    .footer-about .footer-logo {
        justify-content: center;
    }
    
    .footer-social {
        justify-content: center;
    }
}

/* ========================================
   SMALL TABLETS / LARGE PHONES (576px - 767px)
======================================== */
@media (max-width: 767px) {
    :root {
        --apt-header-height: var(--apt-header-height-mobile);
    }
    
    .header-inner {
        padding: 0 15px;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
    
    .logo-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 0.9rem;
    }
    
    .auth-combined-btn a {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .header-cart-toggle {
        width: 38px;
        height: 38px;
    }
    
    /* Hero */
    .hero-section {
        padding: 40px 0 50px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    .hero-stats {
        gap: 20px;
    }
    
    .stat-number {
        font-size: 1.6rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Search Form */
    .search-field input,
    .search-field select {
        padding: 12px 12px 12px 38px;
        font-size: 0.9rem;
    }
    
    .search-field-icon {
        left: 12px;
        font-size: 0.9rem;
    }
    
    .search-submit-btn {
        padding: 12px 20px;
    }
    
    /* Grids */
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    /* Page Header */
    .page-header {
        padding: 40px 0 30px;
    }
    
    .page-title {
        font-size: 1.6rem;
    }
    
    /* Footer */
    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-widget {
        text-align: center;
    }
    
    .footer-contact p {
        justify-content: center;
    }
    
    .site-footer {
        padding: 40px 0 0;
    }
    
    .footer-bottom {
        margin-top: 30px;
    }
    
    /* CTA */
    .cta-section {
        padding: 50px 0;
    }
    
    .cta-section h2 {
        font-size: 1.5rem;
    }
}

/* ========================================
   PHONES (480px - 575px)
======================================== */
@media (max-width: 575px) {
    .header-inner {
        gap: 10px;
    }
    
    .site-title span:not(.logo-icon) {
        display: none;
    }
    
    .auth-combined-btn {
        font-size: 0.8rem;
    }
    
    .auth-combined-btn a {
        padding: 8px 10px;
    }
    
    .menu-toggle {
        width: 40px;
        height: 40px;
        padding: 10px;
    }
    
    /* Hero */
    .hero-search-box {
        padding: 10px;
    }
    
    .hero-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-item {
        text-align: center;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .btn-lg {
        padding: 12px 24px;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .error-actions .btn {
        width: 100%;
    }
    
    /* Back to Top */
    .back-to-top {
        width: 44px;
        height: 44px;
        right: 15px;
        bottom: calc(15px + var(--apt-safe-bottom));
    }
}

/* ========================================
   SMALL PHONES (320px - 479px)
======================================== */
@media (max-width: 479px) {
    :root {
        --apt-header-height-mobile: 60px;
    }
    
    .container,
    .container-wide {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .site-title {
        font-size: 1rem;
    }
    
    .logo-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.8rem;
    }
    
    /* Hide auth text on very small screens */
    .auth-combined-btn a:first-child span,
    .auth-combined-btn a:last-child span {
        display: none;
    }
    
    .auth-combined-btn a:first-child::after {
        content: "Giriş";
    }
    
    .auth-combined-btn a:last-child::after {
        content: "Üye Ol";
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    .feature-card {
        padding: 25px 15px;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .card-body,
    .post-content {
        padding: 15px;
    }
    
    .footer-widget h3 {
        font-size: 0.95rem;
    }
    
    .error-404 h1 {
        font-size: 4rem;
    }
    
    .error-404 h2 {
        font-size: 1.2rem;
    }
}

/* ========================================
   LANDSCAPE PHONE FIX
======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 30px 0 40px;
    }
    
    .hero-stats {
        margin-top: 20px;
    }
    
    .main-navigation {
        padding: 10px 20px;
    }
    
    .nav-menu > li > a {
        padding: 10px 0;
    }
}

/* ========================================
   HIGH DPI / RETINA DISPLAYS
======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .site-logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .site-header,
    .site-footer,
    .back-to-top,
    .menu-toggle,
    .header-actions {
        display: none !important;
    }
    
    .site-container {
        padding-top: 0 !important;
    }
    
    .hero-section {
        background: #fff !important;
        color: #000 !important;
        min-height: auto !important;
        padding: 20px 0 !important;
    }
    
    .hero-title,
    .hero-title span {
        color: #000 !important;
    }
    
    .hero-subtitle {
        color: #333 !important;
    }
    
    .hero-search-box,
    .hero-visual,
    .floating-card {
        display: none !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ========================================
   REDUCED MOTION
======================================== */
@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;
    }
    
    .floating-card {
        animation: none;
    }
}

/* ========================================
   DARK MODE SUPPORT (Future)
======================================== */
@media (prefers-color-scheme: dark) {
    /* Reserved for dark mode */
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-menu > li > a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .btn {
        min-height: 48px;
    }
    
    .header-cart-toggle,
    .menu-toggle {
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Disable hover effects on touch */
    .card:hover,
    .post-card:hover,
    .feature-card:hover {
        transform: none;
    }
    
    /* Active states for touch */
    .btn:active {
        transform: scale(0.98);
    }
    
    .card:active,
    .post-card:active {
        transform: scale(0.99);
    }
}

/* ========================================
   NOTCH & SAFE AREA HANDLING (iOS)
======================================== */
@supports (padding: max(0px)) {
    .site-header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .main-navigation {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    .site-footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
