/* frontend/css/mobile.css */
/* אופטימיזציות מיוחדות למובייל */

/* ===== Touch Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* הגדלת אזורי מגע במכשירים ניידים */
    .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .item-checkbox {
        width: 28px;
        height: 28px;
    }
    
    .item-action-btn {
        width: 36px;
        height: 36px;
    }
}

/* ===== Small Screens (<= 375px) ===== */
@media (max-width: 375px) {
    .app-header h1 {
        font-size: 1.125rem;
    }
    
    .add-item-form {
        flex-wrap: wrap;
    }
    
    .add-item-form input[type="text"] {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .quantity-controls {
        flex: 1;
    }
    
    .item-meta {
        font-size: 0.8125rem;
    }
    
    .login-container {
        padding: 24px;
    }
}

/* ===== Medium Screens (376px - 768px) ===== */
@media (min-width: 376px) and (max-width: 768px) {
    .items-main {
        /* מצב נוח לטלפונים גדולים */
    }
}

/* ===== Landscape Orientation ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .app-header {
        padding: 8px 16px;
    }
    
    .header-content {
        height: 48px;
    }
    
    .add-item-section {
        padding: 12px 16px;
    }
    
    .items-section {
        max-height: calc(100vh - 160px);
    }
    
    .login-container {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===== Tablet Screens (>= 768px) ===== */
@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
        margin: 0 auto;
        box-shadow: var(--shadow-lg);
    }
    
    .items-main {
        flex-direction: row;
    }
    
    .items-section {
        flex: 1;
        border-bottom: none !important;
    }
    
    .items-section:first-child {
        border-left: 2px solid var(--gray-100);
    }
    
    .add-item-form {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .login-container {
        max-width: 480px;
    }
    
    .side-menu {
        width: 320px;
        right: -320px;
    }
}

/* ===== Desktop Screens (>= 1024px) ===== */
@media (min-width: 1024px) {
    .app-container {
        max-width: 1024px;
    }
    
    .items-section {
        max-width: 512px;
    }
}

/* ===== iOS Specific ===== */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari safe area */
    .app-header {
        padding-top: env(safe-area-inset-top);
    }
    
    .add-item-section {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    /* מניעת bounce scrolling */
    body {
        overscroll-behavior-y: none;
    }
    
    .items-list {
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Android Specific ===== */
@media (prefers-color-scheme: dark) {
    /* תמיכה במצב כהה (אופציונלי) */
    :root {
        --gray-50: #18181B;
        --gray-100: #27272A;
        --gray-200: #3F3F46;
        --gray-800: #F4F4F5;
        --gray-900: #FAFAFA;
    }
}

/* ===== PWA Standalone Mode ===== */
@media (display-mode: standalone) {
    /* כאשר מותקן כאפליקציה */
    .app-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    body {
        -webkit-user-select: none;
        user-select: none;
    }
    
    input,
    textarea {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* ===== Print Styles ===== */
@media print {
    .app-header,
    .add-item-section,
    .side-menu,
    .overlay,
    .item-actions {
        display: none !important;
    }
    
    .items-main {
        display: block;
    }
    
    .items-section {
        break-inside: avoid;
    }
    
    .item-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== High Contrast Mode ===== */
@media (prefers-contrast: high) {
    .item-card {
        border-width: 3px;
    }
    
    .item-checkbox {
        border-width: 3px;
    }
    
    button {
        border: 2px solid currentColor;
    }
}

/* ===== Pull to Refresh (disable) ===== */
body {
    overscroll-behavior-y: contain;
}

.items-list {
    overscroll-behavior: contain;
}

/* ===== Virtual Keyboard Handling ===== */
@media (max-height: 500px) {
    .items-main {
        max-height: 50vh;
    }
}

/* Keyboard visible */
.keyboard-visible .items-main {
    height: 30vh;
}

/* ===== Loading States ===== */
.loading .item-card {
    pointer-events: none;
    opacity: 0.6;
}

/* ===== Offline Indicator ===== */
.offline-banner {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--warning-color);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.875rem;
    z-index: 99;
    transform: translateY(-100%);
    transition: transform 0.3s;
}

.offline-banner.show {
    transform: translateY(0);
}

/* ===== Swipe Actions (optional enhancement) ===== */
.item-card.swiping {
    transition: transform 0.2s;
}

.item-card.swipe-left {
    transform: translateX(-80px);
}

.item-card.swipe-right {
    transform: translateX(80px);
}

.swipe-action {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.swipe-action.left {
    left: 0;
    background: var(--danger-color);
}

.swipe-action.right {
    right: 0;
    background: var(--success-color);
}

/* frontend/css/mobile.css */
