/* 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;
}

/* 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: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-group .btn {
    transform: none;
}

/* 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) {
    .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%;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .navbar-collapse {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .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;
}
