/**
 * MyTiszaföldvár - Mobil Optimalizálás
 * Touch gestures, safe area, pull-to-refresh stílusok
 */

/* ========================================
   SAFE AREA TÁMOGATÁS (Notch, Status Bar)
   ======================================== */

/* Safe area változók */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
}

/* Header safe area */
.main-header {
    padding-top: max(1rem, var(--safe-area-top));
    padding-left: max(1rem, var(--safe-area-left));
    padding-right: max(1rem, var(--safe-area-right));
}

/* Footer safe area */
.main-footer {
    padding-bottom: max(1rem, var(--safe-area-bottom));
    padding-left: max(1rem, var(--safe-area-left));
    padding-right: max(1rem, var(--safe-area-right));
}

/* Fixed elemek safe area */
.mobile-menu-toggle {
    margin-right: var(--safe-area-right);
}

/* ========================================
   TOUCH-FRIENDLY ELEMEK
   ======================================== */

/* Minimum tap target méret (44x44px) */
button,
a.btn,
.nav-link,
.mobile-menu-toggle,
.dropdown-toggle,
.carousel-nav,
.carousel-dot,
input[type="submit"],
input[type="button"],
input[type="checkbox"],
input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(244, 208, 63, 0.3);
}

/* Kisebb elemeknél padding növelése */
.small-btn,
.icon-btn {
    padding: 0.75rem;
    min-height: 44px;
    min-width: 44px;
}

/* Input mezők touch optimalizálás */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
textarea,
select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    touch-action: manipulation;
}

/* Checkbox és radio touch optimalizálás */
input[type="checkbox"],
input[type="radio"] {
    width: 44px;
    height: 44px;
    cursor: pointer;
}

/* ========================================
   PULL-TO-REFRESH INDICATOR
   ======================================== */

.pull-to-refresh-indicator {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(244, 208, 63, 0.95);
    color: #1e40af;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.pull-to-refresh-indicator i {
    font-size: 1.2rem;
    animation: spin 1s linear infinite;
}

.pull-to-refresh-indicator.ready i {
    animation: none;
}

.pull-to-refresh-indicator.refreshing i {
    animation: spin 0.5s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   TOUCH GESTURE FEEDBACK
   ======================================== */

/* Touch feedback osztályok */
.touch-device button:active,
.touch-device a:active,
.touch-device .nav-link:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Swipe feedback */
.swiping {
    transition: none !important;
}

/* ========================================
   MOBIL NAVIGÁCIÓ TOUCH OPTIMALIZÁLÁS
   ======================================== */

@media (max-width: 768px) {
    /* Mobil menü touch optimalizálás */
    .main-navigation.mobile-active {
        /* Safe area figyelembe vétele */
        padding-top: max(1rem, var(--safe-area-top));
        padding-bottom: max(1rem, var(--safe-area-bottom));
    }
    
    .nav-link {
        /* Nagyobb tap target mobilra */
        min-height: 50px;
        padding: 1.25rem 2rem;
        /* Touch feedback */
        -webkit-tap-highlight-color: rgba(244, 208, 63, 0.2);
    }
    
    /* Dropdown toggle touch optimalizálás */
    .dropdown-toggle {
        min-height: 50px;
        padding: 1.25rem 2rem;
    }
    
    /* Mobil menü bezárás swipe animáció */
    .main-navigation.swiping {
        transition: transform 0.2s ease-out;
    }
}

/* ========================================
   SCROLL OPTIMALIZÁLÁS
   ======================================== */

/* Smooth scroll touch eszközökön */
@media (hover: none) and (pointer: coarse) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Momentum scrolling */
    .hourly-forecast-scroll,
    .daily-slider-track,
    .cards-carousel-container {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* ========================================
   INSTALL PROMPT STÍLUSOK
   ======================================== */

.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
    color: white;
    padding: 1rem;
    padding-bottom: max(1rem, var(--safe-area-bottom));
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 10000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.install-prompt.show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.install-prompt-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.install-prompt-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.install-prompt-text {
    flex: 1;
}

.install-prompt-text h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.install-prompt-text p {
    font-size: 0.85rem;
    opacity: 0.9;
}

.install-prompt-actions {
    display: flex;
    gap: 0.5rem;
}

.install-prompt-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: #1e40af;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    touch-action: manipulation;
}

.install-prompt-btn:hover {
    background: var(--primary-light);
}

.install-prompt-close {
    background: transparent;
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* ========================================
   VIEWPORT OPTIMALIZÁLÁS
   ======================================== */

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS safe area fix */
    .main-header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    /* iOS input zoom prevention */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px;
    }
}

/* ========================================
   TOUCH DEVICE DETECTION
   ======================================== */

/* Touch device osztályok */
.touch-device * {
    /* Touch optimalizált cursor */
    cursor: pointer;
}

.no-touch * {
    /* Desktop hover effektek */
    cursor: default;
}

/* ========================================
   MOBIL SPECIFIKUS JAVÍTÁSOK
   ======================================== */

/* 100vh fix iOS Safari-hoz */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        height: calc(100vh - 70px);
        min-height: calc(100vh - 70px);
    }
}

/* Horizontal scroll prevention */
body {
    overflow-x: hidden;
    width: 100%;
}

/* Text selection optimalizálás */
@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-user-select: none;
        user-select: none;
    }
    
    input,
    textarea {
        -webkit-user-select: text;
        user-select: text;
    }
}

