/**
 * קובץ עיצוב ראשי למערכת רשימת קניות
 * גרסה מודרנית ומותאמת למובייל
 */

:root {
    --primary-color: #4a6cf7;
    --primary-gradient: linear-gradient(135deg, #ac4af7, #6a8cff);
    --secondary-color: #6c757d;
    --success-color: #32b97c;
    --success-gradient: linear-gradient(135deg, #32b97c, #42d392);
    --danger-color: #ea5455;
    --danger-gradient: linear-gradient(135deg, #ea5455, #f97794);
    --warning-color: #ffbd5c;
    --warning-gradient: linear-gradient(135deg, #ffbd5c, #ffdf8e);
    --info-color: #16b1d4;
    --info-gradient: linear-gradient(135deg, #16b1d4, #4fcbec);
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.12);
    --border-radius: 15px;
    --transition-speed: 0.3s;
}
/* הטענת פונטים מקומיים */
@font-face {
    font-family: 'Fredoka';
    src: url('../fonts/Fredoka/static/Fredoka-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'Fredoka';
    src: url('../fonts/Fredoka/static/Fredoka-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Fredoka';
    src: url('../fonts/Fredoka/static/Fredoka-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'Fredoka';
    src: url('../fonts/Fredoka/static/Fredoka-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: 'Fredoka';
    src: url('../fonts/Fredoka/static/Fredoka-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}
/* עיצוב כללי */
body {
    background-color: var(--light-gray);
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    position: relative;
    color: #333;
    line-height: 1.6;
    /* תמיכה ב-iOS Safe Areas */
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
}

main {
    flex: 1 0 auto;
    padding-bottom: 30px;
}

/* עיצוב ספציפי עבור iOS */
.ios-device {
    /* שיפור הטקסט ב-iOS */
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ios-device input,
.ios-device textarea,
.ios-device select {
    /* מניעת זום אוטומטי בשדות קלט ב-iOS */
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 10px;
}

.ios-device .btn {
    /* שיפור כפתורים ב-iOS */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 12px;
    border: none;
    outline: none;
}

.ios-device .card {
    /* שיפור כרטיסים עבור iOS */
    border-radius: 16px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* אנימציות swipe עבור iOS */
.list-item {
    transition: transform 0.2s ease-out, background-color 0.2s ease-out;
}

.list-item.swiping-right {
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.1) 0%, transparent 100%);
}

.list-item.swiping-left {
    background: linear-gradient(270deg, rgba(220, 53, 69, 0.1) 0%, transparent 100%);
}

/* הסתרת scrollbar ב-iOS */
.ios-device ::-webkit-scrollbar {
    display: none;
}

.ios-device {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* כותרת עליונה מודרנית */
header.bg-primary {
    background: var(--primary-gradient) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
    /* תמיכה ב-iOS Safe Areas */
    padding-top: env(safe-area-inset-top);
    margin-top: calc(-1 * env(safe-area-inset-top));
}

header h1 {
    font-weight: 600;
}

.item-status.badge {
    position: absolute;
    left: 0;
    top: -13px;
}
/* תפריט צדדי למובייל */
.mobile-menu-btn {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
}

.mobile-menu-btn:hover, .mobile-menu-btn:focus {
    background: rgba(255, 255, 255, 0.3);
}

.offcanvas-header {
    background: var(--primary-gradient);
}

.mobile-navigation .nav-link {
    color: var(--dark-gray);
    transition: all 0.3s;
    border-radius: 10px;
}

.mobile-navigation .nav-link:hover, .mobile-navigation .nav-link:focus {
    background-color: var(--light-gray);
    color: var(--primary-color);
    transform: translateX(-5px);
}

.mobile-navigation .nav-link i {
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

/* תפריט ניווט משופר */
.nav-link {
    position: relative;
    margin: 0 5px;
    padding: 10px 15px !important;
    border-radius: 30px;
    transition: all var(--transition-speed);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* סגנון כרטיסים */
.card {
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
}

/* עיצוב כרטיסי רשימות */
.shopping-list-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.shopping-list-card .card-header {
    display: flex;
    align-items: center;
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.shopping-list-card .card-body {
    flex: 1;
}

/* עיצוב כותרת רשימת הפריטים */
.list-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px !important;
}

.list-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.list-title {
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-size: 1.2rem;
}

.list-badges-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.list-badges-container .badge {
    font-size: 0.9rem;
    padding: 6px 12px;
    font-weight: 500;
}

.supermarket-logo {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background-color: white;
    padding: 2px;
}

/* עיצוב לחצנים */
.btn {
    border-radius: 30px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all var(--transition-speed);
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 10px rgba(74, 108, 247, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 15px rgba(74, 108, 247, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-gradient);
    box-shadow: 0 4px 10px rgba(50, 185, 124, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 15px rgba(50, 185, 124, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-gradient);
    box-shadow: 0 4px 10px rgba(234, 84, 85, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 15px rgba(234, 84, 85, 0.4);
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--warning-gradient);
    box-shadow: 0 4px 10px rgba(255, 189, 92, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 6px 15px rgba(255, 189, 92, 0.4);
    transform: translateY(-2px);
}

.btn-outline-primary, .btn-outline-success, .btn-outline-danger {
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-outline-primary:hover, .btn-outline-success:hover, .btn-outline-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* עיצוב אייקונים ולחצני פעולה */
.btn-action {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 5px;
    transition: all var(--transition-speed);
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-action:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* עיצוב פריטים ברשימה */
.list-items {
    list-style: none;
    padding: 0;
}

/* כותרות הפרדה בין סוגי פריטים */
.list-section-header {
    display: flex;
    align-items: center;
    padding: 14px 22px;
    margin: 25px 15px 40px 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    list-style: none;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}


.list-section-header i {
    font-size: 1.3rem;
    margin-left: 10px;
}

.list-section-header .badge {
    font-size: 0.9rem;
    padding: 6px 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* כותרת ממתינים לטיפול */
.list-section-header.pending-header {
    background: linear-gradient(135deg, rgba(74, 108, 247, 0.12), rgba(106, 140, 255, 0.08));
    color: var(--primary-color);
    border-right: 5px solid var(--primary-color);
}

.list-section-header.pending-header i {
    animation: pulse-rotate 2s ease-in-out infinite;
}

/* כותרת מוצרים שנרכשו */
.list-section-header.purchased-header {
    background: linear-gradient(135deg, rgba(50, 185, 124, 0.12), rgba(66, 211, 146, 0.08));
    color: var(--success-color);
    border-right: 5px solid var(--success-color);
    margin-top: 35px;
}

.list-section-header.purchased-header i {
    animation: scale-pulse 1.5s ease-in-out infinite;
}

/* כותרת מוצרים שלא היו במלאי */
.list-section-header.unavailable-header {
    background: linear-gradient(135deg, rgba(234, 84, 85, 0.12), rgba(249, 119, 148, 0.08));
    color: var(--danger-color);
    border-right: 5px solid var(--danger-color);
    margin-top: 35px;
}

.list-section-header.unavailable-header i {
    animation: shake 2s ease-in-out infinite;
}

/* אנימציות לאייקונים בכותרות */
@keyframes pulse-rotate {
    0%, 100% { 
        transform: rotate(0deg) scale(1); 
    }
    50% { 
        transform: rotate(180deg) scale(1.1); 
    }
}

@keyframes scale-pulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.15); 
    }
}

@keyframes shake {
    0%, 100% { 
        transform: translateX(0) rotate(0deg); 
    }
    25% { 
        transform: translateX(-3px) rotate(-5deg); 
    }
    75% { 
        transform: translateX(3px) rotate(5deg); 
    }
}

.list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed);
    border-radius: 10px;
    margin: 25px;

}

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

.list-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
    transform: translateX(-5px);
}

.list-item.purchased {
    background-color: rgba(50, 185, 124, 0.1);
    opacity: 0.75;
}

.list-item.purchased:hover {
    opacity: 1;
}

.list-item.unavailable {
    background-color: rgba(234, 84, 85, 0.1);
    opacity: 0.75;
}

.list-item.unavailable:hover {
    opacity: 1;
}

.product-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    margin-left: 15px;
    background-color: white;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 600;
    margin-bottom: 5px;
}

/* עיצוב השלמה אוטומטית */
.autocomplete-items {
    position: absolute;
    border: none;
    border-top: none;
    z-index: 99;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--card-shadow);
    background-color: #fff;
    top: 100%;
    left: 0;
    right: 0;
    display: block;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    transition: all var(--transition-speed);
}

.autocomplete-item:hover {
    background-color: var(--light-gray);
    transform: translateX(-5px);
}

.autocomplete-item img {
    width: 40px;
    height: 40px;
    margin-left: 15px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* התאמות למובייל - אוטוקומפליט מתחת לשדה החיפוש */
@media (max-width: 767px) {
    .autocomplete-items {
        position: absolute !important;
        top: 100% !important;
        bottom: auto !important;
        margin-top: 5px !important;
        max-height: 250px !important;
        z-index: 1000 !important;
        border-radius: var(--border-radius) !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
        width: 100% !important;
    }
    
    /* סמן דק יותר בניידים */
    .autocomplete-items::-webkit-scrollbar {
        width: 4px !important;
    }
    
    /* גלילה חלקה יותר */
    .autocomplete-items {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* הגדלת פריטי האוטוקומפליט במובייל לנוחות לחיצה */
    .autocomplete-item {
        padding: 15px !important;
        font-size: 16px !important;
        min-height: 55px !important;
    }
    
    /* תיקון מיקום אייקון הטעינה במובייל */
    .search-loading {
        left: 10px !important;
        top: 65% !important;
    }
    
    /* הגדלת התמונות בתוצאות חיפוש במובייל */
    .autocomplete-item img {
        width: 45px !important;
        height: 45px !important;
        margin-left: 12px !important;
    }
    
    /* תיקון למצב שבו יש המון תוצאות והן גורמות לתצוגה שלמה להיעלם */
    .col-md-5.position-relative {
        position: relative !important;
        z-index: 50 !important;
    }
}
.product-placeholder {
    width: 40px;
    height: 40px;
    margin-left: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* כאשר משמש ברשימת הקניות */
.list-item .product-placeholder {
    width: 50px;
    height: 50px;
    margin: 0 0 0 15px;
}

.product-placeholder i {
    font-size: 20px;
    color: #adb5bd;
}

.list-item .product-placeholder i {
    font-size: 24px;
}

/* עיצוב סטטיסטיקות וגרפים */
.statistics-card {
    margin-bottom: 30px;
}

.chart-container {
    position: relative;
    height: 350px;
    margin: 20px 0;
}

/* אנימציות ואפקטים */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes slideInRight {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in {
    animation: slideInRight 0.5s ease-out;
}

/* מודאלים */
.modal-content {
    border-radius: var(--border-radius);
    overflow: hidden;
    border: none;
    box-shadow: var(--card-shadow);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px;
}

/* שיפורים לפורמים */
.form-control, .form-select {
    border-radius: 10px;
    padding: 12px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed);
}

h5.mb-0 {
    margin-left: 20px;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
    border-color: var(--primary-color);
}

/* Badge עיצוב */
.badge {
    padding: 8px 12px;
    border-radius: 30px;
    font-weight: 500;
}

/* תכונות התקדמות (Progress) */
.progress {
    height: 20px;
    border-radius: 30px;
    background-color: rgba(0, 0, 0, 0.05);
    margin: 10px 0;
}

.progress-bar {
    background: var(--success-gradient);
    border-radius: 30px;
}

/* עיצוב פוטר */
footer {
    background: var(--light-gray);
    padding: 20px 0;
}

/* Responsive עיצוב */
@media (max-width: 991px) {
    .nav {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .card-header {
        /* flex-direction: column; */
        align-items: flex-start;
    }
    
    .card-body {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    header .container {
        padding-right: 15px;
        padding-left: 15px;
    }

    h5.mb-0 {
        margin-left: 80px;
    }
    
    /* התאמת כותרת רשימת פריטים לטאבלט */
    .list-header-content {
        gap: 15px;
    }
    
    .list-title {
        font-size: 1.15rem;
    }
    
    .list-badges-container .badge {
        font-size: 0.85rem;
        padding: 5px 11px;
    }
    
    .nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 10px;
        margin-right: -15px;
        margin-left: -15px;
        padding-right: 15px;
        padding-left: 15px;
    }
    
    .nav-item {
        flex: 0 0 auto;
    }
    
    .nav-link {
        padding: 8px 12px !important;
        margin: 0 2px;
        font-size: 0.9rem;
    }
    
    .list-item {
        flex-wrap: wrap;
        margin: 10px;
    }
    
    .list-item .product-info {
        flex: 1 0 100%;
        margin-bottom: 10px;
    }
    
    .list-item .ms-auto {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
    }
    
    .btn {
        padding: 6px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    h2 {
        font-size: 1.5rem;
    }
    
    .product-image {
        width: 45px;
        height: 45px;
        margin-left: 10px;
    }
    
    .card-header, .card-body, .card-footer {
        padding: 12px;
    }
    
    /* תיקון כותרת רשימת הפריטים במובייל */
    .list-card-header {
        padding: 15px !important;
    }
    
    .list-header-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .list-title {
        font-size: 1.1rem;
        width: 100%;
    }
    
    .list-badges-container {
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
    }
    
    .list-badges-container .badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
    }

    .card .d-flex.justify-content-between {
        flex-direction: row;
    }
    
    
    .d-flex.justify-content-between > *:not(:last-child) {
        margin-bottom: 10px;
    }
    
    /* התאמות לכותרת במובייל */
    header h1 {
        font-size: 1.3rem !important;
    }
    
    /* עיצוב כפתור התפריט */
    .mobile-menu-btn {
        margin-right: -5px;
    }
    
    /* תיקון לטפסי העלאה במובייל */
    input[type="file"].form-control {
        font-size: 0.9rem;
        padding: 8px;
    }
    
    /* ודא שהטופס תמיד שולח את כל הנתונים */
    #editItemModal form {
        width: 100%;
    }
    
    #editItemModal .modal-body, 
    #editItemModal .modal-footer {
        padding: 15px;
    }
    
    .list-item {
        flex-direction: row !important;
        align-items: center !important;
        padding: 12px 8px;
        margin-bottom: 30px;
        border-radius: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        background: #fff;
        flex-wrap: wrap;
    }
    .list-item .product-image {
        margin: 0 0 0 12px;
        display: block;
        width: 55px;
        height: 55px;
        flex-shrink: 0;
    }
    .list-item .product-info {
        text-align: right;
        margin-bottom: 0;
        flex: 1 1 0;
        min-width: 0;
    }
    .list-item .ms-auto,
    .list-item .actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        gap: 10px;
        margin-top: 10px;
        margin-right: 67px; /* כדי לא להיצמד לתמונה */
    }
    
    /* התאמות לכותרות הפרדה במובייל */
    .list-section-header {
        margin: 18px 10px 40px 10px;
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 10px;
    }
    
    .list-section-header i {
        font-size: 1.1rem;
        margin-left: 8px;
    }
    
    .list-section-header .badge {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    
    .list-section-header.purchased-header,
    .list-section-header.unavailable-header {
        margin-top: 20px;
    }
    
    /* התאמת הכותרת העליונה למובייל */
    .card-header .d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-header .badge {
        font-size: 0.75rem !important;
        padding: 4px 8px !important;
    }
}
 
