/*
 * style.css - Custom Stylesheet for نواقص المنزل App (Phase 5.1 UI Layout Update)
 * Works alongside Bootstrap 5. Includes Google Font "Noto Kufi Arabic".
 */

/* --- (كل التنسيقات السابقة من الخطوة 5 تبقى كما هي) --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;500;600;700&display=swap');
:root {
    --bs-body-direction: rtl;
    --bs-body-text-align: right;
}

body { 
    font-family: 'Noto Kufi Arabic', system-ui, -apple-system, sans-serif; 
    direction: rtl; 
    text-align: right;
    background-color: #f8f9fa; 
    font-size: 1rem; 
    padding-bottom: 70px; 
    line-height: 1.6; 
    overflow-x: hidden; 
}

/* تحسين دعم RTL للعناصر المختلفة */
.modal-header .btn-close {
    margin: calc(-.5 * var(--bs-modal-header-padding-y)) auto calc(-.5 * var(--bs-modal-header-padding-y)) calc(-.5 * var(--bs-modal-header-padding-x));
}

.form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

.form-switch {
    padding-right: 2.5em;
    padding-left: 0;
}

.form-switch .form-check-input {
    margin-right: -2.5em;
    margin-left: 0;
}

.me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
.me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
.ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
.ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
h1, h2, h3, h4, h5, h6, .fw-bold { font-weight: 700; }
.container { max-width: 960px; }
.navbar { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); background-color: rgba(13, 110, 253, 0.95) !important; }
.navbar-brand { font-weight: 700; letter-spacing: -0.5px; }
.navbar-brand i { font-size: 1.3em; vertical-align: -0.15em; }
.nav-pills { background: white; border-radius: 12px; padding: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.nav-pills .nav-link { font-weight: 600; font-size: 0.95rem; color: #6c757d; padding: 0.7rem 1rem; transition: all 0.2s ease; border-radius: 8px; }
.nav-pills .nav-link.active { background-color: #0d6efd; color: white; box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3); }
.nav-pills .nav-link i { font-size: 1.1em; margin-left: 0.4rem; } /* Adjusted margin for RTL */
.list-group { border-radius: 12px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); /* Add subtle border */}
.list-group-item { border: none; border-bottom: 1px solid rgba(0,0,0,0.05); padding: 1rem; background: white; transition: transform 0.2s ease; word-wrap: break-word; overflow-wrap: break-word; }
.list-group-item:hover { transform: translateY(-1px); }
.list-group-item:last-child { border-bottom: none; }
.list-group-item.urgent-item { border-right: 4px solid #dc3545; background-color: rgba(220, 53, 69, 0.03); }
.list-group-item.unavailable-item { border-right: 4px solid #ffc107; background-color: rgba(255, 193, 7, 0.03); }
.item-details { line-height: 1.5; flex-grow: 1; }
.item-details .item-name { font-size: 1.1rem; font-weight: 600; color: #212529; margin-bottom: 0.1rem; /* Reduced margin */}
.item-details .notes { font-size: 0.85rem; color: #6c757d; margin-top: 0.3rem; } /* Slightly increased margin */
.item-details .metadata { font-size: 0.8rem; color: #adb5bd; margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0 0.8rem; /* Add horizontal gap */}
.metadata span { display: inline-block; /* Make spans behave for gap */}
.category-badge { font-size: 0.75rem; font-weight: 500; padding: 0.3em 0.6em; border-radius: 6px; background-color: #e9ecef; color: #495057; vertical-align: middle; margin-left: 0.5rem; /* Margin before badge in RTL */ }
.category-icon { font-size: 1.1em; vertical-align: -0.1em; margin-left: 0.4rem; /* Margin before icon in RTL */ }
.unavailable-name { text-decoration: line-through; color: #6c757d; }
.status-info { font-weight: bold; color: var(--bs-warning-text-emphasis); font-size: 0.85em; display: block; margin-top: 0.2rem; }
.fab-add-button { position: fixed; bottom: 75px; /* Adjusted for footer */ right: 20px; /* Changed from left for RTL */ left: auto; width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3); transition: transform 0.2s ease; z-index: 1030; }
.fab-add-button:hover { transform: scale(1.05); }
.fab-add-button i { font-size: 1.5rem; }
.cancel-item-btn { 
    padding: 0.4rem 0.6rem;
    margin-right: 0.75rem;
    opacity: 0.85;
    transition: all 0.2s ease;
    border-radius: 8px;
    border: 1px solid rgba(220, 53, 69, 0.2);
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}
.cancel-item-btn:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
    transform: translateY(-1px);
}
.cancel-item-btn:active {
    transform: translateY(0);
}
.modal-content { border-radius: 16px; border: none; }
.modal-header { border-bottom: none; padding: 1.5rem 1.5rem 1rem; }
.modal-body { padding: 1rem 1.5rem; }
.modal-footer { border-top: 1px solid rgba(0,0,0,0.05); padding: 1rem 1.5rem; }
.form-control, .form-select { border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); padding: 0.6rem 1rem; font-size: 0.95rem; }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15); }
footer.fixed-bottom { background-color: white; border-top: 1px solid rgba(0,0,0,0.05); padding: 0.8rem 0; z-index: 1031; box-shadow: 0 -2px 5px rgba(0,0,0,0.05); } /* Added shadow */
footer p { margin-bottom: 0; }
.feedback { border-radius: 12px; padding: 1rem; margin-bottom: 1rem; border: none; }
.spinner-border { width: 1.2rem; height: 1.2rem; border-width: 0.15em; vertical-align: -0.125em; }
#submit-button .spinner-border { width: 1em; height: 1em; margin-left: 0.5em; margin-right: 0; }

/* --- *** تنسيقات جديدة لتخطيط أفضل لعناصر القائمة *** --- */
.item-primary-info {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* مسافة بين الأيقونة والاسم والشارة */
    margin-bottom: 0.3rem; /* مسافة تحت السطر الأول */
}

.item-secondary-info {
    font-size: 0.85rem;
    color: #6c757d;
    display: flex;
    flex-wrap: wrap; /* السماح بالتفاف العناصر الثانوية */
    gap: 0.2rem 1rem; /* مسافة عمودية بسيطة وأفقية أكبر */
    margin-top: 0.5rem;
}
.item-secondary-info span { /* لضمان تطبيق الـ gap بشكل جيد */
    display: inline-block;
}
/* ----------------------------------------------------------- */


/* Responsive Adjustments */
@media (max-width: 767.98px) {
    body { padding-bottom: 65px; /* تقليل المسافة للفوتر الأصغر */ }
    .fab-add-button { width: 50px; height: 50px; bottom: 70px; right: 16px; /* تعديل موضع RTL */ left: auto; }
    .fab-add-button i { font-size: 1.25rem; }
    footer.fixed-bottom { padding: 0.6rem 0; }
    .modal-dialog { margin: 0.5rem; }
    .list-group-item { padding: 0.8rem; } /* تقليل حشو عناصر القائمة */
    .item-details .item-name { font-size: 1.05rem; }
    .category-icon { font-size: 1.1em; }
}

@media (max-width: 576px) {
    .nav-pills .nav-link { font-size: 0.85rem; padding: 0.6rem 0.5rem; }
    .item-details .item-name { font-size: 1rem; }
    .category-badge { font-size: 0.7rem; }
    .fab-add-button { width: 48px; height: 48px; bottom: 65px; right: 12px; left: auto; }
    footer.fixed-bottom { font-size: 0.75rem; }
}
/* --- تنسيقات إضافية للعناصر المشتراة --- */
.list-group-item.purchased-item {
    border-right: 4px solid var(--bs-success); /* شريط أخضر على اليمين */
    background-color: rgba(var(--bs-success-rgb), 0.04); /* خلفية خضراء شفافة قليلاً */
}

.list-group-item.purchased-item .item-name {
    /* يمكنك إضافة تنسيق إضافي للاسم إذا أردت */
     color: var(--bs-success-text-emphasis);
}

.list-group-item.purchased-item .item-action-button {
    /* قد لا تحتاج لزر هنا، تأكد من حجز مسافة للمحافظة على المحاذاة */
    min-width: 40px;
}