/**
 * אופטימיזציה מתקדמת למובייל
 * Y Community - Mobile Optimization CSS
 * 
 * תכונות:
 * - רספונסיביות מתקדמת
 * - תמיכה בגסצ'רים
 * - אופטימיזציה למסכים קטנים
 * - שיפור נגישות
 * - ביצועים מותאמים למובייל
 */

/* משתנים CSS למובייל */
:root {
    --mobile-padding: 1rem;
    --mobile-margin: 0.5rem;
    --mobile-font-size: 16px;
    --mobile-line-height: 1.5;
    --mobile-touch-target: 44px;
    --mobile-border-radius: 12px;
    --mobile-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --mobile-transition: 0.2s ease;
}

/* בסיס מובייל */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    html {
        font-size: var(--mobile-font-size);
        line-height: var(--mobile-line-height);
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
        background: #f8f9fa;
    }

    /* קונטיינר ראשי */
    .mobile-container {
        max-width: 100%;
        padding: 0 var(--mobile-padding);
        margin: 0 auto;
    }

    /* כותרות מותאמות */
    h1 { font-size: 1.75rem; margin: 1rem 0 0.5rem; }
    h2 { font-size: 1.5rem; margin: 0.875rem 0 0.5rem; }
    h3 { font-size: 1.25rem; margin: 0.75rem 0 0.5rem; }
    h4 { font-size: 1.125rem; margin: 0.625rem 0 0.5rem; }
    
    /* פסקאות */
    p {
        margin: 0 0 1rem;
        line-height: var(--mobile-line-height);
    }

    /* ניווט מובייל */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e9ecef;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        justify-content: space-around;
        padding: 0.5rem 0;
        backdrop-filter: blur(10px);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        min-width: var(--mobile-touch-target);
        min-height: var(--mobile-touch-target);
        color: #6c757d;
        text-decoration: none;
        transition: color var(--mobile-transition);
        border-radius: 8px;
    }

    .mobile-nav-item.active,
    .mobile-nav-item:hover {
        color: var(--brand-primary-light, #a0df50);
        background: rgba(160, 223, 80, 0.1);
    }

    .mobile-nav-icon {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }

    .mobile-nav-text {
        font-size: 0.75rem;
        font-weight: 500;
    }

    /* כפתורים מותאמים למובייל */
    .btn {
        min-height: var(--mobile-touch-target);
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        border-radius: var(--mobile-border-radius);
        touch-action: manipulation;
        user-select: none;
    }

    .btn-mobile-full {
        width: 100%;
        margin-bottom: 1rem;
    }

    /* Hero למובייל */
    .hero {
        padding: 2rem 0;
        text-align: center;
        background: var(--gradient-hero);
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    /* כרטיסים למובייל */
    .mobile-card {
        background: white;
        border-radius: var(--mobile-border-radius);
        padding: 1.5rem;
        margin-bottom: 1rem;
        box-shadow: var(--mobile-shadow);
        border: 1px solid #e9ecef;
    }

    .mobile-card:hover {
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
        transform: translateY(-2px);
        transition: all var(--mobile-transition);
    }

    /* גריד למובייל */
    .mobile-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 var(--mobile-padding);
    }

    .mobile-grid-2 {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    /* טפסים למובייל */
    .mobile-form {
        padding: var(--mobile-padding);
    }

    .mobile-form-group {
        margin-bottom: 1rem;
    }

    .mobile-form-label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .mobile-form-input {
        width: 100%;
        padding: 0.75rem;
        border: 2px solid #e9ecef;
        border-radius: var(--mobile-border-radius);
        font-size: 1rem;
        background: white;
        transition: border-color var(--mobile-transition);
    }

    .mobile-form-input:focus {
        outline: none;
        border-color: var(--brand-primary-light, #a0df50);
        box-shadow: 0 0 0 3px rgba(160, 223, 80, 0.1);
    }

    /* Footer למובייל */
    .mobile-footer {
        padding: 2rem 0 6rem; /* מקום לניווט התחתון */
        background: var(--brand-primary);
        color: white;
        text-align: center;
    }

    /* אנימציות למובייל */
    .mobile-fade-in {
        animation: mobileSlideUp 0.3s ease-out;
    }

    @keyframes mobileSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* מודלים למובייל */
    .mobile-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 2000;
        display: flex;
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }

    .mobile-modal-content {
        background: white;
        width: 100%;
        border-radius: 1rem 1rem 0 0;
        padding: 1.5rem;
        max-height: 80vh;
        overflow-y: auto;
        animation: slideUpModal 0.3s ease-out;
    }

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

    /* Swipe gestures */
    .mobile-swipeable {
        touch-action: pan-y;
        overflow-x: hidden;
    }

    /* Pull to refresh */
    .mobile-pull-refresh {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* טאבים למובייל */
    .mobile-tabs {
        display: flex;
        background: white;
        border-bottom: 1px solid #e9ecef;
        position: sticky;
        top: 60px; /* גובה הניווט העליון */
        z-index: 100;
    }

    .mobile-tab {
        flex: 1;
        padding: 0.75rem;
        text-align: center;
        background: none;
        border: none;
        color: #6c757d;
        font-weight: 500;
        cursor: pointer;
        transition: all var(--mobile-transition);
    }

    .mobile-tab.active {
        color: var(--brand-primary-light, #a0df50);
        border-bottom: 2px solid var(--brand-primary-light, #a0df50);
    }

    /* דירוגים וכוכבים */
    .mobile-rating {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        margin: 0.5rem 0;
    }

    .mobile-star {
        color: #ffd700;
        font-size: 1rem;
    }

    /* בדג'ים */
    .mobile-badge {
        display: inline-block;
        padding: 0.25rem 0.5rem;
        background: var(--brand-primary-light, #a0df50);
        color: var(--brand-primary);
        border-radius: 1rem;
        font-size: 0.75rem;
        font-weight: 600;
        margin: 0.25rem;
    }

    /* רשימות */
    .mobile-list {
        background: white;
        border-radius: var(--mobile-border-radius);
        overflow: hidden;
        margin-bottom: 1rem;
    }

    .mobile-list-item {
        padding: 1rem;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        gap: 1rem;
        color: inherit;
        text-decoration: none;
        transition: background var(--mobile-transition);
    }

    .mobile-list-item:hover {
        background: #f8f9fa;
    }

    .mobile-list-item:last-child {
        border-bottom: none;
    }

    /* אינדיקטורי טעינה */
    .mobile-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem;
    }

    .mobile-spinner {
        width: 2rem;
        height: 2rem;
        border: 3px solid #f0f0f0;
        border-top: 3px solid var(--brand-primary-light, #a0df50);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    /* הודעות Toast */
    .mobile-toast {
        position: fixed;
        top: 1rem;
        left: 1rem;
        right: 1rem;
        background: var(--brand-primary);
        color: white;
        padding: 1rem;
        border-radius: var(--mobile-border-radius);
        z-index: 3000;
        animation: toastSlideDown 0.3s ease-out;
    }

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

    /* בחירת תאריכ */
    .mobile-date-picker {
        background: white;
        border: 2px solid #e9ecef;
        border-radius: var(--mobile-border-radius);
        font-size: 1rem;
        padding: 0.75rem;
        width: 100%;
    }

    /* גלריה למובייל */
    .mobile-gallery {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
        padding: var(--mobile-padding);
    }

    .mobile-gallery-item {
        aspect-ratio: 1;
        border-radius: var(--mobile-border-radius);
        overflow: hidden;
        background: #f0f0f0;
    }

    .mobile-gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* מסכים קטנים במיוחד */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.5rem;
    }
    
    .mobile-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
    }
}

/* מצב לנדסקייפ במובייל */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-nav {
        display: none;
    }
    
    .hero {
        padding: 1rem 0;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
} 