/**
 * Unified Design System - Sales Invoice Style
 * يُطبق تلقائياً على جميع الصفحات
 */

/* ==================== متغيرات التصميم ==================== */
:root {
    --design-card-padding: 1.5rem;
    --design-info-padding: 1.5rem;
    --design-table-header-bg: #f8f9fa;
    --design-border-radius: 0.375rem;
    --design-border-color: #dee2e6;
    --design-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --design-shadow-hover: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* ==================== البطاقات (Cards) ==================== */
.card {
    border-radius: var(--design-border-radius);
    box-shadow: var(--design-shadow);
    border: 1px solid var(--design-border-color);
    margin-bottom: 1rem;
}

.card-header {
    background-color: var(--design-table-header-bg);
    border-bottom: 1px solid var(--design-border-color);
    padding: 0.75rem 1rem;
    font-weight: 600;
}

.card-body {
    padding: var(--design-card-padding);
}

/* قسم المعلومات - padding 1.5rem */
.card-body.info-section,
.card-body[class*="info"]
{
    padding: var(--design-info-padding);
}

/* ==================== الجداول ==================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--design-table-header-bg);
    border-bottom: 2px solid var(--design-border-color);
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--design-border-color);
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* جدول المعلومات (Info Table) */
#invoiceInfoTable th,
#billInfoTable th,
#orderInfoTable th,
#quoteInfoTable th,
#receiptInfoTable th,
#returnInfoTable th,
#requisitionInfoTable th,
[id$="InfoTable"] th {
    background-color: var(--design-table-header-bg);
    width: 12%;
    font-weight: 600;
}

/* ==================== أزرار Odoo Style ==================== */
.odoo-save-btn {
    background: linear-gradient(135deg, #714B67 0%, #5a3d54 100%);
    border: none;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: var(--design-border-radius);
    font-weight: 600;
    transition: all 0.2s ease;
}

.odoo-save-btn:hover {
    background: linear-gradient(135deg, #5a3d54 0%, #4a3246 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--design-shadow-hover);
}

.odoo-save-btn:active {
    transform: translateY(0);
}

/* ==================== حقول الإدخال ==================== */
.form-control,
.form-select {
    border-radius: var(--design-border-radius);
    border: 1px solid var(--design-border-color);
    padding: 0.375rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: #714B67;
    box-shadow: 0 0 0 0.2rem rgba(113, 75, 103, 0.25);
}

.form-control-sm,
.form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ==================== Select2 Styling ==================== */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: var(--design-border-radius);
    border: 1px solid var(--design-border-color);
}

.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: #714B67;
    box-shadow: 0 0 0 0.2rem rgba(113, 75, 103, 0.25);
}

/* ==================== Badges ==================== */
.badge {
    border-radius: var(--design-border-radius);
    padding: 0.35em 0.65em;
    font-weight: 500;
}

/* ==================== Alerts ==================== */
.alert {
    border-radius: var(--design-border-radius);
    border: none;
}

.alert-info {
    background-color: #e7f3ff;
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

/* ==================== قسم الحفظ والعودة ==================== */
.card.bg-light {
    background-color: #f8f9fa !important;
}

.card.bg-light .card-body {
    padding: 0.75rem 1rem;
}

/* ==================== إجماليات الفاتورة ==================== */
.invoice-totals tr,
.bill-totals tr,
.order-totals tr,
.quote-totals tr,
[class$="-totals"] tr {
    background-color: #f8f9fa;
}

.invoice-totals tr:last-child,
.bill-totals tr:last-child,
.order-totals tr:last-child,
.quote-totals tr:last-child,
[class$="-totals"] tr:last-child {
    background-color: rgba(113, 75, 103, 0.1);
    border-top: 2px solid #714B67;
}

/* ==================== أرقام الصفوف ==================== */
.row-number {
    font-weight: 600;
    color: #6c757d;
    text-align: center;
}

/* ==================== حقل الإجمالي ==================== */
.item-total {
    font-weight: 700;
    background-color: #f8f9fa !important;
}

/* ==================== زر الحذف ==================== */
.remove-item-btn {
    padding: 0.25rem 0.5rem;
    border-radius: var(--design-border-radius);
}

.remove-item-btn:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* ==================== RTL Support ==================== */
[dir="rtl"] .text-end {
    text-align: left !important;
}

[dir="rtl"] .text-start {
    text-align: right !important;
}

[dir="rtl"] .me-1, [dir="rtl"] .me-2, [dir="rtl"] .me-3 {
    margin-right: 0 !important;
    margin-left: 0.25rem;
}

[dir="rtl"] .ms-1, [dir="rtl"] .ms-2, [dir="rtl"] .ms-3 {
    margin-left: 0 !important;
    margin-right: 0.25rem;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .odoo-save-btn {
        padding: 0.375rem 1rem;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .odoo-save-btn,
    .remove-item-btn,
    .btn {
        display: none !important;
    }
}
