/* css/style.css - גרסה מתוקנת ורספונסיבית */

:root {
    --primary-color: #1e3a8a; /* כחול נייבי */
    --accent-gold: #b45309;   /* זהב עתיק */
    --success-green: #065f46; /* ירוק */
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
}

/* תיקון: תמיכה באזור הבטוח של אייפון (Safe Area) */
.pb-safe-area {
    padding-bottom: 12px; 
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

body {
    font-family: 'Heebo', sans-serif;
    /* תיקון: רקע נקי יותר למסכים גדולים */
    background-color: #eef2f6; 
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    min-height: 100vh;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* תיקון: הקונטיינר הראשי של האפליקציה */
/* תיקון: הקונטיינר הראשי מקובע למסך ללא גלילה חיצונית */
#app-container {
    background-color: #f8fafc;
    height: 100dvh; /* גובה דינמי מותאם למובייל */
    width: 100%;
    max-width: 28rem; /* max-w-md */
    margin: 0 auto;
    position: relative;
    overflow: hidden; /* מונע מהמסך הראשי לזוז */
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
    border-left: 1px solid rgba(255,255,255,0.5);
    border-right: 1px solid rgba(255,255,255,0.5);
}

/* התוכן הפנימי הוא זה שנגלול */
#main-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* גלילה חלקה באייפון */
    padding-bottom: 6rem; /* מקום לתפריט התחתון */
}
/* --- תיקוני בסיס --- */
input, textarea, select {
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: manipulation !important;
    cursor: text !important;
    pointer-events: auto !important;
    transform: translate3d(0,0,0);
}

/* --- Glassmorphism --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    position: relative;
    z-index: 1;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* --- אנימציות --- */
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- כפתור סריקה צף (Scan FAB) --- */
/* שינינו את המיקום כדי שיהיה יחסי לתפריט החדש */
.scan-fab {
    /* העיצוב עבר לתוך ה-HTML עצמו בגרסה החדשה, כאן נשאיר רק בסיס למקרה הצורך */
    display: none; 
}

/* --- ווידג'טים בדשבורד --- */
.section-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 12px; color: #1f2937; display: flex; justify-content: space-between; align-items: center; }

.horizontal-scroll { 
    display: flex; gap: 12px; overflow-x: auto; 
    padding-bottom: 10px; scrollbar-width: none; 
    scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.horizontal-scroll::-webkit-scrollbar { display: none; }

.mini-card {
    min-width: 140px; width: 140px;
    background: rgba(255,255,255,0.9); 
    border-radius: 12px; padding: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03); 
    flex-shrink: 0; border: 1px solid rgba(255,255,255,0.5);
}

/* --- פילטרים --- */
.category-wrapper { position: relative; display: flex; align-items: center; }
.category-filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 12px 4px; scrollbar-width: none; }
.category-filters::-webkit-scrollbar { display: none; }

.filter-chip {
    white-space: nowrap; padding: 6px 16px; border-radius: 20px;
    font-size: 13px; font-weight: 500;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0,0,0,0.05);
    color: #4b5563; transition: all 0.2s; cursor: pointer;
}
.filter-chip.active { background: var(--primary-color); color: white; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2); border-color: transparent; }

.scroll-arrow {
    display: none; background: rgba(255,255,255,0.9); border-radius: 50%; width: 28px; height: 28px;
    align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); cursor: pointer; z-index: 10; position: absolute; font-weight: bold;
}
@media (min-width: 768px) {
    .category-wrapper:hover .scroll-arrow { display: flex; }
    .scroll-arrow.left { left: -10px; }
    .scroll-arrow.right { right: -10px; }
}

/* --- תפריט משתמש וצ'אט --- */
.user-avatar { 
    width: 38px; height: 38px; 
    background: linear-gradient(135deg, var(--primary-color), #3b82f6); 
    color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; 
    font-weight: bold; font-size: 14px; cursor: pointer; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 60; border: 2px solid white; 
}
.notification-btn { position: relative; padding: 8px; font-size: 20px; cursor: pointer; z-index: 60; }
.badge { position: absolute; top: 0; right: 0; width: 10px; height: 10px; background-color: #ef4444; border-radius: 50%; border: 2px solid white; }

.dropdown-menu { 
    position: absolute; top: 60px; left: 16px; width: 200px; 
    background: white; border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
    padding: 8px 0; transform-origin: top left; transform: translateY(-10px); 
    opacity: 0; pointer-events: none; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 9999; 
}
.dropdown-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 14px; color: #374151; cursor: pointer; }
.dropdown-item:hover { background-color: #f3f4f6; }

.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 16px; margin-bottom: 8px; font-size: 0.9rem; line-height: 1.4; position: relative; word-wrap: break-word; }
.chat-bubble.mine { background-color: var(--primary-color); color: white; margin-right: auto; border-bottom-right-radius: 4px; }
.chat-bubble.theirs { background-color: white; border: 1px solid rgba(0,0,0,0.05); color: #333; margin-left: auto; border-bottom-left-radius: 4px; }
.chat-time { font-size: 0.65rem; margin-top: 4px; opacity: 0.7; text-align: right; }

/* --- מודאל Bottom Sheet --- */
.glass-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: 500px; margin: 0 auto;
    height: 85vh; background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
    z-index: 1001; /* מעל התפריט התחתון */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}
.glass-panel.open { transform: translateY(0); }

.modal-scroll-area {
    flex: 1; overflow-y: auto;
    padding: 20px; padding-bottom: 140px; 
    -webkit-overflow-scrolling: touch;
}

.modal-footer-sticky {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 20px; z-index: 1002;
    background: linear-gradient(to top, white 90%, transparent);
}

#save-item-btn {
    background: linear-gradient(135deg, var(--primary-color), #1e40af);
    border-radius: 14px; color: white; font-weight: bold;
    width: 100%; padding: 16px; 
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
    border: none; cursor: pointer;
}

/* --- שערי שוק --- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

#market-tickers .glass {
    border-right: 3px solid #f59e0b;
    flex: 0 0 auto;
    transition: all 0.3s ease;
}

#res-marketing {
    background: linear-gradient(to right, #fefce8, #fef9c3);
    border-right: 4px solid var(--accent-gold);
    padding: 12px; border-radius: 12px;
}

/* תיקונים שונים ל-iOS */
header.glass {
    padding-top: calc(0.75rem + env(safe-area-inset-top)) !important;
    height: auto !important;
}
.user-avatar, .notification-btn {
    position: relative;
    z-index: 100 !important; 
}
.dropdown-menu {
    top: calc(60px + env(safe-area-inset-top)) !important;
}
#chat-room-view > .glass {
    padding-top: calc(1rem + env(safe-area-inset-top)) !important;
    height: auto !important;
}

/* תיקונים לתפריט הניווט החדש */
.nav-item.active {
    color: var(--primary-color);
}
.nav-item.active div {
    opacity: 1;
}

/* ריווח בכרטיסיות לוגין */
#login-view .glass, #onboarding-view .glass {
    margin-left: 1rem;
    margin-right: 1rem;
    width: auto; 
}

/* --- תוספות עבור תצוגת אוסף (גלריה ואלבומים) --- */

/* כרטיס אלבום (תיקייה) */
.album-card {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* אפקט ערימה */
    box-shadow: 
        0 0 0 1px rgba(0,0,0,0.05),
        5px 5px 0 -1px white, 
        5px 5px 0 0 rgba(0,0,0,0.1),
        10px 10px 0 -1px white, 
        10px 10px 0 0 rgba(0,0,0,0.05);
    margin-bottom: 12px;
}
.album-card:active { transform: scale(0.98); }

.album-cover {
    height: 140px;
    width: 100%;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.album-info { padding: 12px; }

/* כרטיס מוזיאון (פריט בודד) */
.museum-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateZ(0);
}
.museum-card:active { transform: scale(0.96); }

.card-gradient-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 50%);
    position: absolute; bottom: 0; left: 0; right: 0; height: 100%; pointer-events: none;
}

.status-pill {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid rgba(255,255,255,0.5);
    font-weight: 700;
}

/* כפתור חזור דביק */
.sticky-header {
    position: sticky; top: 0; z-index: 30;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 10px 16px;
    display: flex; align-items: center; gap: 12px;
    transition: all 0.3s ease;
    border-radius: 12px;
    margin-bottom: 12px;
}

/* אנימציית כניסה */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.item-entry {
    animation: slideUpFade 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
}

/* --- עיצוב מסך סריקה חדש (כמו CoinSnap) --- */
.scan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.scan-slot {
    aspect-ratio: 1; /* ריבוע מושלם */
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.scan-slot:active {
    transform: scale(0.95);
    background-color: #e2e8f0;
    border-color: var(--primary-color);
}

.scan-slot.has-image {
    border-style: solid;
    border-color: var(--primary-color);
}

.scan-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
}

.scan-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-top: 8px;
    z-index: 2;
}

.scan-icon {
    font-size: 28px;
    color: #94a3b8;
    z-index: 2;
}

/* --- תוספת עבור מודל דירוג --- */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
.star-rating input { display: none; }
.star-rating label {
    font-size: 32px;
    color: #cbd5e1; /* אפור */
    cursor: pointer;
    transition: color 0.2s;
}
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #f59e0b; /* צהוב/זהב */
}