/**
 * iPad Responsive Styles
 * Temiz Tarifler - iPad Optimization
 *
 * Breakpoints:
 * - iPad Mini/Air Portrait: 768px - 834px
 * - iPad Portrait: 768px - 1024px
 * - iPad Landscape: 1024px - 1366px
 * - iPad Pro 12.9": 1024px - 1366px
 */

/* ========================================
   iPad Portrait Mode (768px - 1024px)
   ======================================== */
@media only screen
  and (min-device-width: 768px)
  and (max-device-width: 1024px)
  and (orientation: portrait),
  screen and (min-width: 768px) and (max-width: 1024px) {

    /* Header/Navigation */
    .uc-header .uc-navbar {
        min-height: 64px;
        padding: 0 16px;
    }

    .uc-navbar-left,
    .uc-navbar-right {
        gap: 12px;
    }

    /* Show navigation menu on iPad */
    .uc-navbar-center .uc-navbar-nav,
    .uc-navbar-nav.d-none.lg\:d-flex {
        display: flex !important;
        gap: 12px;
        font-size: 13px;
    }

    .uc-navbar-nav > li > a {
        padding: 8px 8px;
        white-space: nowrap;
    }

    /* Hide less important nav items on smaller iPads */
    @media (max-width: 900px) {
        .uc-navbar-nav > li:nth-child(n+5) {
            display: none;
        }
    }

    /* Show profile/login on iPad */
    .uc-navbar-item.d-none.md\:d-flex,
    .uc-navbar-item.d-none.md\:d-block {
        display: flex !important;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 8px 14px;
    }

    /* Touch-friendly links */
    .uc-navbar-nav li a,
    .nav-y li a,
    .nav-x li a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Grid Layouts - 2-3 columns on iPad */
    .tools-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px !important;
    }

    .recipe-grid,
    .category-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }

    /* Row children */
    .row.child-cols-3 {
        --uc-child-cols: 3;
    }

    .row.child-cols-4 {
        --uc-child-cols: 3;
    }

    .row.child-cols-6 {
        --uc-child-cols: 4;
    }

    /* Container padding */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Card spacing */
    .recipe-card,
    .tool-card,
    .category-card {
        padding: 16px;
    }

    /* Typography adjustments */
    h1, .h1 {
        font-size: 2rem;
    }

    h2, .h2 {
        font-size: 1.75rem;
    }

    h3, .h3 {
        font-size: 1.5rem;
    }

    /* Footer adjustments */
    .footer-nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    /* Instagram grid - 4 columns on iPad */
    .instagram-widget .row {
        --uc-child-cols: 4;
    }

    /* Form elements - touch friendly */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 10px 14px;
    }

    /* Dropdown menus */
    .uc-navbar-dropdown,
    .uc-drop {
        min-width: 200px;
    }

    .uc-navbar-dropdown li a {
        padding: 12px 16px;
    }

    /* Swiper/Slider adjustments */
    .swiper-button-prev,
    .swiper-button-next {
        width: 44px;
        height: 44px;
    }

    /* Modal adjustments */
    .modal-dialog,
    .uc-modal-dialog {
        max-width: 90%;
        margin: 20px auto;
    }

    /* Search modal */
    #uc-search-modal .modal-dialog {
        max-width: 600px;
    }

    /* Meal plan grid */
    .meal-plan-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Profile page */
    .profile-sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .profile-content {
        width: 100%;
    }

    /* Hide center logo on iPad to save space */
    .uc-center-navbar {
        display: none !important;
    }

    /* Show small logo always */
    .hide-on-default {
        display: block !important;
    }

    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }
}

/* ========================================
   iPad Landscape Mode (1024px - 1366px)
   ======================================== */
@media only screen
  and (min-device-width: 768px)
  and (max-device-width: 1366px)
  and (orientation: landscape),
  screen and (min-width: 1024px) and (max-width: 1366px) {

    /* Header/Navigation - Full menu visible */
    .uc-header .uc-navbar {
        min-height: 72px;
        padding: 0 20px;
    }

    .uc-navbar-center .uc-navbar-nav {
        display: flex !important;
        gap: 20px;
        font-size: 15px;
    }

    /* Grid Layouts - More columns in landscape */
    .tools-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }

    .recipe-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 24px !important;
    }

    .category-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }

    /* Row children */
    .row.child-cols-4 {
        --uc-child-cols: 4;
    }

    .row.child-cols-6 {
        --uc-child-cols: 5;
    }

    /* Container */
    .container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .container.max-w-2xl {
        max-width: 1200px;
    }

    /* Instagram grid */
    .instagram-widget .row {
        --uc-child-cols: 6;
    }

    /* Meal plan - show all 7 days */
    .meal-plan-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Profile layout */
    .profile-container {
        display: flex;
        gap: 30px;
    }

    .profile-sidebar {
        width: 280px;
        flex-shrink: 0;
    }

    .profile-content {
        flex: 1;
    }

    /* Recipe detail sidebar */
    .recipe-detail-container {
        display: flex;
        gap: 30px;
    }

    .recipe-main {
        flex: 1;
    }

    .recipe-sidebar {
        width: 320px;
        flex-shrink: 0;
    }

    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 24px;
    }
}

/* ========================================
   iPad Pro 12.9" Specific
   ======================================== */
@media only screen
  and (min-device-width: 1024px)
  and (max-device-width: 1366px)
  and (-webkit-min-device-pixel-ratio: 2) {

    .container.max-w-2xl {
        max-width: 1280px;
    }

    .tools-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }

    .recipe-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ========================================
   Touch Device Optimizations
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects that don't work on touch */
    .uc-transition-toggle:hover .uc-transition-scale-up {
        transform: none;
    }

    /* Larger tap targets */
    .uc-menu-trigger,
    .uc-search-trigger,
    .backtotop-wrap a {
        min-width: 48px;
        min-height: 48px;
    }

    /* Disable hover dropdowns - require tap */
    .uc-navbar-dropdown {
        display: none !important;
    }

    [data-uc-drop].uc-open .uc-navbar-dropdown,
    .uc-drop.uc-open {
        display: block !important;
    }

    /* Better scrolling */
    .swiper-wrapper {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent text selection on buttons */
    .btn,
    .uc-menu-trigger,
    .uc-search-trigger {
        -webkit-user-select: none;
        user-select: none;
    }

    /* Active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Card tap feedback */
    .recipe-card:active,
    .tool-card:active,
    .category-card:active {
        transform: scale(0.99);
        transition: transform 0.1s ease;
    }
}

/* ========================================
   iOS Safari Specific Fixes
   ======================================== */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS Safari viewport height */
    .min-vh-100 {
        min-height: -webkit-fill-available;
    }

    /* Fix sticky positioning */
    .uc-header.uc-navbar-sticky {
        position: -webkit-sticky;
        position: sticky;
    }

    /* Fix for iOS rubber band scrolling */
    body {
        overscroll-behavior-y: none;
    }

    /* Safe area padding for notch devices */
    .uc-header {
        padding-top: env(safe-area-inset-top);
    }

    .uc-footer {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Cookie banner safe area */
    .cookie-banner {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* ========================================
   Print Styles (for iPad print)
   ======================================== */
@media print {
    .uc-header,
    .uc-footer,
    .backtotop-wrap,
    .cookie-banner {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .recipe-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
