/* Custom styles for Tailor Shop Management */

/* Cairo font (local) */
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 8px;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

body {
    background-color: var(--light-color);
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* زر القائمة الجانبية الطافي للشاشات الكبيرة */
.floating-menu-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1040;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
    color: white;
    padding: 1rem;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 500;
}

.floating-menu-btn:hover {
    background: linear-gradient(135deg, #0a58ca 0%, #084298 100%);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.floating-menu-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.floating-menu-btn i {
    font-size: 1.5rem;
    line-height: 1;
}

/* RTL: زر القائمة الجانبية على أقصى اليمين (للعربية) */
html[dir="rtl"] .floating-menu-btn {
    right: 20px;
    left: auto;
}

/* إخفاء زر القائمة الجانبية في الشاشات الكبيرة من القائمة العلوية */
@media (min-width: 992px) {
    .navbar-toggler {
        display: none !important;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-group .btn {
    transform: none;
    border-radius: 8px !important;
    margin: 0 2px !important;
}

.btn-group .btn:first-child {
    margin-left: 0 !important;
    margin-right: 2px !important;
}

.btn-group .btn:last-child {
    margin-right: 0 !important;
    margin-left: 2px !important;
}

[dir="rtl"] .btn-group .btn:first-child {
    margin-right: 0 !important;
    margin-left: 2px !important;
}

[dir="rtl"] .btn-group .btn:last-child {
    margin-left: 0 !important;
    margin-right: 2px !important;
}

/* Tables */
.table {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.table thead th {
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

/* Forms */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Search functionality */
.search-input {
    max-width: 300px;
}

@media (max-width: 768px) {
    .search-input {
        max-width: 100%;
    }
}

/* Badges */
.badge {
    font-size: 0.75em;
    font-weight: 600;
    border-radius: var(--border-radius);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* Dashboard cards */
.dashboard-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15);
}

/* Responsive utilities */
@media (max-width: 576px) {
    /* تحسين القائمة في الشاشات الصغيرة جداً */
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .navbar-collapse {
        max-height: calc(100vh - 70px);
    }
    
    .navbar-nav .nav-link {
        font-size: 0.95rem;
        padding: 0.625rem 0.875rem;
    }
    
    .navbar-nav .dropdown-item {
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius) !important;
        margin-bottom: 0.25rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between > * {
        width: 100%;
    }
}

/* Offcanvas Sidebar Styles for Mobile */
.offcanvas.offcanvas-mobile {
    width: 280px !important;
    max-width: 85vw;
}

/* في LTR: القائمة من اليسار */
html:not([dir="rtl"]) .offcanvas.offcanvas-mobile.offcanvas-start {
    left: 0 !important;
    right: auto !important;
    transform: translateX(-100%) !important;
}

html:not([dir="rtl"]) .offcanvas.offcanvas-mobile.offcanvas-start.show {
    transform: translateX(0) !important;
}

/* التأكد من أن القائمة تعمل في جميع الحالات */
.offcanvas.offcanvas-mobile {
    visibility: visible !important;
    transition: transform 0.3s ease-in-out !important;
    z-index: 1045 !important;
}

.offcanvas-body {
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* إزالة مظهر القائمة العلوية من القائمة الجانبية */
.offcanvas-body .navbar-nav {
    width: 100% !important;
    flex-direction: column !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.offcanvas-body .nav-item {
    width: 100% !important;
    margin-bottom: 0.25rem !important;
    display: block !important;
}

.offcanvas-body .nav-link {
    padding: 0.75rem 1rem !important;
    width: 100% !important;
    text-align: right !important;
    border-radius: 0.375rem !important;
    transition: background-color 0.2s ease !important;
    color: rgba(255, 255, 255, 0.9) !important;
    display: block !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
}

.offcanvas-body .nav-link:hover,
.offcanvas-body .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.offcanvas-body .dropdown-menu {
    position: static !important;
    float: none !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    box-shadow: none !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: none !important;
    padding: 0.5rem 0 !important;
}

/* إظهار القائمة المنسدلة عند فتحها */
.offcanvas-body .dropdown.show .dropdown-menu,
.offcanvas-body .dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.offcanvas-body .dropdown-item {
    padding: 0.75rem 1rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 0.375rem !important;
    margin: 0.25rem 0 !important;
    display: block !important;
    width: 100% !important;
    text-align: right !important;
    text-decoration: none !important;
    background: transparent !important;
}

.offcanvas-body .dropdown-item:hover,
.offcanvas-body .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.offcanvas-body .dropdown-header {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    margin: 0 !important;
}

.offcanvas-body .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1) !important;
    margin: 0.5rem 0 !important;
}

/* Backdrop for offcanvas */
.offcanvas-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

/* إخفاء القائمة العادية في الشاشات الصغيرة فقط */
@media (max-width: 991px) {
    /* إخفاء القائمة العادية في الموبايل والتابلت */
    .navbar-collapse {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* إخفاء جميع عناصر القائمة العلوية في الموبايل */
    .navbar .navbar-nav:not(.offcanvas-body .navbar-nav) {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* إخفاء جميع dropdowns في القائمة العلوية */
    .navbar .dropdown-menu:not(.offcanvas-body .dropdown-menu) {
        display: none !important;
        visibility: hidden !important;
    }
}

/* في الشاشات الكبيرة: إظهار القائمة العلوية وإخفاء زر القائمة الجانبية من القائمة العلوية */
@media (min-width: 992px) {
    .navbar-collapse {
        display: flex !important;
    }
    
    /* إخفاء زر القائمة الجانبية من القائمة العلوية في الشاشات الكبيرة */
    .navbar-toggler {
        display: none !important;
    }
    
    /* إظهار فقط navbar-brand وزر القائمة الجانبية - LTR فقط */
    html:not([dir="rtl"]) .navbar {
        min-height: 56px;
    }
    
    html:not([dir="rtl"]) .navbar .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* تحسين زر القائمة (hamburger) - LTR فقط */
    html:not([dir="rtl"]) .navbar-toggler {
        border: 1px solid rgba(255, 255, 255, 0.3);
        padding: 0.5rem 0.75rem;
        order: 2;
        margin-left: auto;
        margin-right: 0;
    }
    
    html:not([dir="rtl"]) .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    }
    
    html:not([dir="rtl"]) .navbar-brand {
        order: 1;
        margin: 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .table-responsive {
        border-radius: var(--border-radius);
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .no-print,
    .alert,
    .pagination {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    
    .card-header {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
    }
    
    body {
        background-color: white !important;
        font-size: 12px;
    }
    
    .table {
        font-size: 11px;
    }
    
    .badge {
        border: 1px solid #dee2e6;
        color: #000 !important;
        background-color: #f8f9fa !important;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Form validation */
.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: block;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: var(--success-color);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Status indicators */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-active {
    background-color: var(--success-color);
}

.status-inactive {
    background-color: var(--secondary-color);
}

.status-warning {
    background-color: var(--warning-color);
}

/* Footer */
footer {
    margin-top: auto;
    background-color: var(--light-color);
    border-top: 1px solid #dee2e6;
}

/* Utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-hover {
    transition: box-shadow 0.3s ease;
}

.shadow-hover:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Select2 Custom Styling */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: var(--border-radius) !important;
    border: 1px solid #dee2e6 !important;
    min-height: 38px !important;
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding: 0.375rem 2.25rem 0.375rem 0.75rem !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-left: 0;
    padding-right: 0;
    line-height: 1.5;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 36px;
    position: absolute;
    top: 1px;
    right: 1px;
    width: 32px;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    z-index: 1;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-radius: var(--border-radius) !important;
    border: 1px solid var(--primary-color) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-radius: var(--border-radius) !important;
    border: 1px solid #dee2e6 !important;
    padding: 0.375rem 0.75rem !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: rgba(var(--bs-primary-rgb), 0.1) !important;
    color: var(--dark-color) !important;
}

/* Make Select2 work better on mobile */
@media (max-width: 768px) {
    .select2-container--bootstrap-5 .select2-dropdown {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
        font-size: 16px !important;
    }
}

/* Select2 loading state */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
}

.select2-container--bootstrap-5 .select2-selection__clear {
    margin-right: 10px !important;
}

/* Custom file input styling for RTL */
.custom-file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    top: 0;
    left: 0;
}

.custom-file-input-label {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: pointer;
    min-height: 38px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.custom-file-input-label:hover {
    border-color: #86b7fe;
}

.custom-file-input-wrapper input[type="file"]:focus + .custom-file-input-label {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.custom-file-input-text {
    flex: 1;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-file-input-button {
    padding: 0.375rem 0.75rem;
    background-color: #0d6efd;
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 400;
    transition: background-color 0.15s ease-in-out;
}

.custom-file-input-button:hover {
    background-color: #0b5ed7;
}

[dir="rtl"] .custom-file-input-label {
    flex-direction: row-reverse;
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .custom-file-input-text {
    text-align: right;
}

[dir="rtl"] .custom-file-input-button {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* توحيد أزرار قائمة أوامر القص */
.cut-order-actions .btn {
    border-radius: 8px !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-width: 1px !important;
    transition: all 0.2s ease-in-out !important;
    min-width: auto !important;
    white-space: nowrap !important;
}

.cut-order-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cut-order-actions .btn:active {
    transform: translateY(0);
}

/* Mobile: Stack buttons vertically */
@media (max-width: 767px) {
    .cut-order-actions {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        width: 100%;
    }
    
    .cut-order-actions .btn {
        width: 100%;
        margin: 0 !important;
    }
    
    .cut-order-actions form {
        width: 100%;
    }
}
