/* Global Font */
body { 
    font-family: 'Vazirmatn', sans-serif; 
}

/* Sidebar */
.sidebar-icon { 
    stroke-width: 1.5; 
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.toast { 
    padding: 12px 20px; 
    border-radius: 8px; 
    color: white; 
    opacity: 0; 
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(20px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.toast.show { 
    opacity: 1; 
    transform: translateY(0);
}
.toast.success { background-color: #22c55e; } /* green-500 */
.toast.error { background-color: #ef4444; } /* red-500 */

/* Product Search Results in Invoice */
.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e2e8f0; /* slate-200 */
    background-color: white;
    z-index: 100;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.search-results div {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.875rem; /* text-sm */
}
.search-results div:hover {
    background-color: #f1f5f9; /* slate-100 */
}

/* Modal Styles */
.modal-backdrop {
    position: fixed; 
    inset: 0; 
    background-color: rgb(0 0 0 / 0.5); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 1rem; 
    z-index: 50;
}
.modal-backdrop.hidden {
    display: none;
}
.modal-content {
    background-color: white;
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); /* shadow-xl */
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 1rem; /* p-4 */
    border-bottom: 1px solid #e2e8f0; /* border-b */
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-close-btn {
    color: #64748b; /* text-slate-500 */
}
.modal-close-btn:hover {
    color: #0f172a; /* text-slate-800 */
}
.modal-footer {
    padding: 1rem; /* p-4 */
    background-color: #f8fafc; /* bg-slate-50 */
    border-top: 1px solid #e2e8f0; /* border-t */
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem; /* gap-3 */
}

/* Form & Button Base Styles (for modals, etc.) */
.form-label {
    display: block;
    font-size: 0.875rem; /* text-sm */
    font-weight: 500; /* font-medium */
    color: #334155; /* text-slate-700 */
    margin-bottom: 0.25rem; /* mb-1 */
}
.form-input {
    width: 100%;
    border-color: #cbd5e1; /* border-slate-300 */
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); /* shadow-sm */
}
.form-input:focus {
    border-color: #475569; /* focus:border-slate-500 */
    box-shadow: 0 0 0 1px #475569; /* focus:ring-slate-500 */
}

.spinner {
    width: 1.25rem; /* w-5 */
    height: 1.25rem; /* h-5 */
    border-width: 2px;
    border-color: white;
    border-top-color: transparent;
    border-radius: 9999px; /* rounded-full */
    animation: spin 1s linear infinite;
    display: none; /* hidden */
}
.spinner-inline {
    display: inline-block;
    vertical-align: middle;
}

.btn-primary {
    padding-left: 1rem; padding-right: 1rem;
    padding-top: 0.5rem; padding-bottom: 0.5rem;
    border-radius: 0.5rem; /* rounded-lg */
    background-color: #1e293b; /* bg-slate-800 */
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* gap-2 */
}
.btn-primary:hover { background-color: #334155; } /* hover:bg-slate-700 */
.btn-primary:disabled { background-color: #94a3b8; cursor: not-allowed; }

.btn-secondary {
    padding-left: 1rem; padding-right: 1rem;
    padding-top: 0.5rem; padding-bottom: 0.5rem;
    border-radius: 0.5rem; /* rounded-lg */
    border: 1px solid #cbd5e1; /* border-slate-300 */
    background-color: white;
    color: #334155; /* text-slate-700 */
}
.btn-secondary:hover { background-color: #f8fafc; } /* hover:bg-slate-50 */

.btn-danger {
    padding-left: 1rem; padding-right: 1rem;
    padding-top: 0.5rem; padding-bottom: 0.5rem;
    border-radius: 0.5rem; /* rounded-lg */
    background-color: #dc2626; /* bg-red-600 */
    color: white;
}
.btn-danger:hover { background-color: #b91c1c; } /* hover:bg-red-700 */


.icon-btn {
    color: #64748b; /* text-slate-500 */
}
.icon-btn:hover {
    color: #0f172a; /* text-slate-800 */
}
.icon-btn-danger {
    color: #ef4444; /* text-red-500 */
}
.icon-btn-danger:hover {
    color: #b91c1c; /* text-red-800 */
}

/* Table Helper Classes */
.table-loading-cell,
.table-empty-cell,
.table-error-cell {
    text-align: center;
    padding: 2rem; /* p-8 */
    color: #64748b; /* text-slate-500 */
}
.table-error-cell {
    color: #ef4444; /* text-red-500 */
}
/* استایل‌های جدید برای فرم محصول */
.price-input {
    direction: ltr;
    text-align: left;
}

/* استایل برای پیش‌نمایش تصویر */
#product-image-preview {
    transition: opacity 0.3s ease;
}

#product-image-placeholder {
    transition: border-color 0.3s ease;
}

#product-image-placeholder:hover {
    border-color: #94a3b8;
}

/* استایل برای دکمه اسکن بارکد */
#product-barcode-scan {
    transition: all 0.2s ease;
}

#product-barcode-scan:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

/* استایل برای textareaها */
.form-input textarea {
    resize: vertical;
    min-height: 80px;
}

/* استایل برای دکمه افزودن گروه کالایی */
#add-category-btn {
    transition: all 0.2s ease;
    min-width: 44px;
}

#add-category-btn:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

/* [جدید] Styles for Image Library Modal */
.image-library-grid {
    display: grid;
    /* responsive grid: 4 تا 8 ستون بسته به عرض صفحه */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}
.library-image-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* ایجاد نسبت تصویر ۱:۱ (مربعی) */
    border-radius: 0.5rem; /* rounded-lg */
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, transform 0.2s ease-in-out;
    background-color: #f1f5f9; /* bg-slate-100 */
}
.library-image-item:hover {
    border-color: #3b82f6; /* blue-500 */
    transform: scale(1.05);
}
.library-image-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* تصاویر را به زیبایی برش می‌زند */
}
.library-image-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* تصاویر را به زیبایی برش می‌زند */
}

/* [جدید] استایل‌های کارت موبایل */
.mobile-card {
    @apply bg-white rounded-lg shadow border border-slate-200 p-4 flex flex-col;
}
.mobile-card-header {
    @apply flex justify-between items-center mb-3;
}
.mobile-card-title {
    @apply font-bold text-slate-800 truncate;
}
.mobile-card-body {
    @apply space-y-2 text-sm;
}
.mobile-card-row {
    @apply flex justify-between items-center;
}
.mobile-card-label {
    @apply text-slate-500;
}
.mobile-card-value {
    @apply font-medium text-slate-700;
}
.mobile-card-actions {
    @apply flex items-center gap-2 border-t pt-3 mt-3;
}