/* Common Styles */
:root {
    --primary: #4361E8;
    --secondary: #5A7AFF;
    --tertiary: #7B9AFF;
    --quaternary: #9CB8FF;
    --light-bg: #F6F5FA;
    --light-card: #FFFFFF;
    
    --dark-primary: #3D52A0;
    --dark-secondary: #5873C8;
    --dark-tertiary: #7091E6;
    --dark-quaternary: #8697C4;
    --dark-bg: #121212;
    --dark-text: #EDE8F5;
    
    /* Additional color variables for invoice modal */
    --success: #28a745;
    --danger: #dc3545;
    --warning: #fd7e14;
    --info: #17a2b8;
    
    /* Light mode specific colors */
    --card-bg: #f8f9fa;
    --text-primary: #495057;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --border-light: #f8f9fa;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --table-header-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    
    /* Success colors */
    --success-light: #d4edda;
    --success-dark: #155724;
    --success-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    
    /* Warning colors */
    --warning-light: #fff3cd;
    --warning-dark: #856404;
    
    /* Danger colors */
    --danger-light: rgba(220, 53, 69, 0.1);
    
    /* Stock info colors */
    --stock-available: #198754;
    --stock-zero: #dc3545;
    --stock-low: #fd7e14;
    --stock-info-bg: #f8f9fa;
    --stock-info-border: #dee2e6;
    
    /* Primary gradient */
    --primary-gradient: linear-gradient(135deg, #4361E8 0%, #5A7AFF 100%);
}

/* Dark mode overrides */
[data-bs-theme="dark"] {
    --card-bg: #2c3034;
    --text-primary: #EDE8F5;
    --text-secondary: #adb5bd;
    --border-color: #495057;
    --border-light: #495057;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --table-header-bg: linear-gradient(135deg, #2c3034 0%, #212529 100%);
    
    /* Dark mode specific colors */
    --dark-card-bg: #2c3034;
    --dark-text-secondary: #adb5bd;
    --dark-border: #495057;
    --dark-table-header: linear-gradient(135deg, #2c3034 0%, #212529 100%);
    
    /* Additional dark mode variables for invoice modal */
    --dark-primary: #3D52A0;
    --dark-secondary: #5873C8;
    --dark-success: #28a745;
    --dark-text: #EDE8F5;
    --dark-border-light: #495057;
    
    /* Invoice modal dark mode colors */
    --dark-modal-bg: #2c3034;
    --dark-modal-border: #495057;
    --dark-modal-text: #e9ecef;
    --dark-modal-text-secondary: #adb5bd;
    --dark-modal-bg-light: #343a40;
    --dark-modal-border-light: #6c757d;
    
    /* Stock info dark mode colors */
    --dark-stock-available: #28a745;
    --dark-stock-zero: #dc3545;
    --dark-stock-low: #fd7e14;
    --dark-stock-info-bg: #2c3034;
    --dark-stock-info-border: #495057;
}

[data-bs-theme="light"] {
    --bs-body-bg: var(--light-bg);
    --bs-body-color: #212529;
}

[data-bs-theme="dark"] {
    --bs-body-bg: var(--dark-bg);
    --bs-body-color: var(--dark-text);
}

/* RTL Support */
html {
    direction: rtl;
    text-align: right;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bs-body-bg);
    font-family: 'Rabar', sans-serif;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.container-fluid {
    flex: 1;
}

/* RTL specific adjustments */
.input-group > :not(:first-child) {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > :not(:last-child) {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

/* Dark mode button styles */
[data-bs-theme="dark"] .btn {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #000000;
}

[data-bs-theme="dark"] .btn:hover {
    background-color: #f8f9fa;
    border-color: #f8f9fa;
    color: #000000;
}

[data-bs-theme="dark"] .btn:focus {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #000000;
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

[data-bs-theme="dark"] .btn:active {
    background-color: #e9ecef;
    border-color: #e9ecef;
    color: #000000;
}

/* Dark mode navbar dropdown styles - only on hover/active */
[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #ffffff;
    color: #000000;
}

[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #ffffff;
    color: #000000;
}

[data-bs-theme="dark"] .dropdown-item:active {
    background-color: #ffffff;
    color: #000000;
}

/* Dark mode navbar list items - only on hover/active */
[data-bs-theme="dark"] .navbar-nav .nav-link:hover {
    background-color: #ffffff;
    color: #000000;
}

[data-bs-theme="dark"] .navbar-nav .nav-link:focus {
    background-color: #ffffff;
    color: #000000;
}

[data-bs-theme="dark"] .navbar-nav .nav-link.active {
    background-color: #ffffff;
    color: #000000;
}

/* Dark mode navbar dropdown toggle - only on hover/active */
[data-bs-theme="dark"] .dropdown-toggle:hover {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #000000;
}

[data-bs-theme="dark"] .dropdown-toggle:focus {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #000000;
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

.form-control:focus {
    border-color: var(--tertiary);
    box-shadow: 0 0 0 0.25rem rgba(126, 144, 230, 0.25);
}

/* Font Face Declaration */
@font-face {
    font-family: 'Rabar';
    src: url('../fonts/Rabar_021.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
} 

/* Pagination Styles */
.pagination {
    margin-bottom: 0;
}

.pagination .page-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background-color: #f8f9fa;
    color: #0d6efd;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    color: #0a58ca;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    color: white;
}

.pagination .page-item.disabled .page-link {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: var(--bs-body-bg);
    border-radius: 0.5rem;
}

.table-controls .records-info {
    color: #6c757d;
}

.table-controls .records-per-page {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bs-body-bg);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-controls .records-per-page label {
    margin: 0;
    color: var(--bs-body-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.table-controls select {
    padding: 0.4rem 2.5rem 0.4rem 1rem;
    border: 1px solid var(--tertiary);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%233D52A0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 0.75rem) center;
    background-size: 1rem;
}

.table-controls select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(61, 82, 160, 0.1);
}

.table-controls select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(61, 82, 160, 0.15);
    outline: none;
}

.table-controls select option {
    padding: 0.5rem;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .table-controls select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23EDE8F5' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

[data-bs-theme="dark"] .table-controls select:hover {
    border-color: var(--dark-tertiary);
}

[data-bs-theme="dark"] .table-controls select:focus {
    border-color: var(--dark-tertiary);
    box-shadow: 0 0 0 0.2rem rgba(112, 145, 230, 0.15);
}

[data-bs-theme="dark"] .table-controls select option {
    padding: 0.5rem;
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

/* Column Search Styles */
.column-search {
    position: relative;
    margin-bottom: 0.5rem;
}

.column-search input {
    width: 100%;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border: 1px solid var(--tertiary);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.column-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(61, 82, 160, 0.15);
    outline: none;
}

.column-search::after {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%233D52A0' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.5;
}

[data-bs-theme="dark"] .column-search::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23EDE8F5' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
}

.column-search input::placeholder {
    color: var(--tertiary);
    opacity: 0.7;
}

[data-bs-theme="dark"] .column-search input::placeholder {
    color: var(--dark-tertiary);
}

/* Table Header with Search */
.table-header-with-search {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-header-with-search .header-text {
    margin: 0;
    font-weight: 500;
    color: var(--bs-body-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .column-search input {
        font-size: 0.85rem;
        padding: 0.35rem 1.75rem 0.35rem 0.6rem;
    }
}

/* Circular action buttons */
.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-size: 1.3rem;
    margin: 0 2px;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.08);
    vertical-align: middle;
}
.action-btn.edit {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.12);
}
.action-btn.view {
    color: #0dcaf0;
    background: rgba(13, 202, 240, 0.12);
}
.action-btn.edit:hover, .action-btn.edit:focus {
    background: #ffc107;
    color: #212529;
}
.action-btn.view:hover, .action-btn.view:focus {
    background: #0dcaf0;
    color: #212529;
}
.action-btn.info {
    color: #0dcaf0;
    background: rgba(13, 202, 240, 0.12);
}
.action-btn.info:hover, .action-btn.info:focus {
    background: #0dcaf0;
    color: #212529;
}
.action-btn.delete {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.12);
}
.action-btn.delete:hover, .action-btn.delete:focus {
    background: #dc3545;
    color: #fff;
}
.action-btn.person {
    color: #3D52A0;
    background: rgba(61, 82, 160, 0.12);
}
.action-btn.person:hover, .action-btn.person:focus {
    background: #3D52A0;
    color: #fff;
}
.action-btn.pdf {
    background-color: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}
.action-btn.pdf:hover {
    background-color: #dc3545;
    color: white;
}

/* Beautiful icon circle styles for page headers */
.icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f8f9fa;
    margin-left: 10px;
    box-shadow: 0 0 8px #0002;
    transition: background 0.2s;
}
.icon-circle i {
    font-size: 2rem;
    color: #ffc107;
    transition: color 0.2s;
}
.icon-customers {
    background: #fff3cd; /* light yellow */
}
.icon-customers i {
    color: #ffc107;
}
.icon-suppliers {
    background: #cff4fc; /* light blue */
}
.icon-suppliers i {
    color: #0dcaf0;
}
.icon-mixed {
    background: #d1f5e0; /* light green */
}
.icon-mixed i {
    color: #28a745;
}

[data-bs-theme="dark"] .icon-circle {
    background: #333 !important;
} 

/* Custom scrollbar styling for light/dark mode */

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-thumb {
    background: var(--dark-primary);
    border-radius: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #23272b;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--dark-primary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--dark-primary) #f1f1f1;
}
[data-bs-theme="dark"] * {
    scrollbar-color: var(--dark-primary) #23272b;
}

/* Access Denied page styles */
.card.border-danger {
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.1);
    border-width: 2px;
    transition: all 0.3s ease;
}

.card.border-danger:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(220, 53, 69, 0.2);
}

.card-header.bg-danger {
    background-color: var(--bs-danger) !important;
    border-bottom: none;
    padding: 1.25rem;
}

.bi-lock-fill.text-danger {
    animation: pulse 2s infinite;
    text-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

.access-denied-container {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Unauthorized Access Card Modern Style */
.unauthorized-card {
    max-width: 350px;
    margin: 60px auto;
    padding: 32px 20px;
    background: #23242a;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    text-align: center;
    color: #fff;
    border: 1.5px solid #e74c3c;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.unauthorized-card .icon {
    font-size: 48px;
    color: #e74c3c;
    margin-bottom: 18px;
}
.unauthorized-card .title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
}
.unauthorized-card .desc {
    font-size: 15px;
    margin-bottom: 18px;
    color: #ccc;
}
.unauthorized-card .btn {
    background: #4666ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}
.unauthorized-card .btn:hover {
    background: #2d4dcc;
}
@media (max-width: 500px) {
    .unauthorized-card {
        max-width: 95vw;
        padding: 18px 5px;
    }
    .unauthorized-card .title {
        font-size: 18px;
    }
    .unauthorized-card .desc {
        font-size: 13px;
    }
}

.unauthorized-outer {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Base styles for invoice modal */
.invoice-details-container {
    font-family: 'Rabar_021', 'Segoe UI', sans-serif;
    text-align: right;
    direction: rtl;
}

.invoice-details-container .info-group {
    margin-bottom: 1rem;
}

.invoice-details-container .info-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.invoice-details-container .info-value {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.invoice-details-container .invoice-section {
    margin-bottom: 2rem;
}

.invoice-details-container .section-title {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid;
}

.invoice-details-container .totals-card {
    border: 1px solid !important;
}

.invoice-details-container .total-row {
    margin-bottom: 0.5rem;
}

.invoice-details-container .total-row:last-child {
    margin-bottom: 0;
}

/* Light mode styles for invoice modal */
[data-bs-theme="light"] .invoice-details-container {
    color: #212529;
}

[data-bs-theme="light"] .invoice-details-container .info-label {
    color: #495057;
}

[data-bs-theme="light"] .invoice-details-container .info-value {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #212529;
}

[data-bs-theme="light"] .invoice-details-container .section-title {
    color: #495057;
    border-bottom-color: #e9ecef;
}

[data-bs-theme="light"] .invoice-details-container .totals-card {
    background: #f8f9fa;
    border-color: #dee2e6 !important;
}

[data-bs-theme="light"] .invoice-details-container .table th {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #212529;
}

[data-bs-theme="light"] .invoice-details-container .table td {
    border-color: #dee2e6;
    color: #212529;
}

/* Dark mode styles for invoice modal */
[data-bs-theme="dark"] .invoice-details-container {
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .invoice-details-container .info-label {
    color: var(--dark-modal-text-secondary);
}

[data-bs-theme="dark"] .invoice-details-container .info-value {
    background: var(--dark-modal-bg-light);
    border-color: var(--dark-modal-border-light);
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .invoice-details-container .section-title {
    color: var(--dark-modal-text);
    border-bottom-color: var(--dark-modal-border-light);
}

[data-bs-theme="dark"] .invoice-details-container .totals-card {
    background: var(--dark-modal-bg-light);
    border-color: var(--dark-modal-border-light) !important;
}

[data-bs-theme="dark"] .invoice-details-container .table {
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .invoice-details-container .table th {
    background: var(--dark-modal-bg);
    border-color: var(--dark-modal-border-light);
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .invoice-details-container .table td {
    border-color: var(--dark-modal-border-light);
    color: var(--dark-modal-text);
}

/* Dark mode for SweetAlert2 modal */
[data-bs-theme="dark"] .swal2-popup {
    background: var(--dark-modal-bg);
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .swal2-popup .swal2-title {
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .swal2-popup .swal2-html-container {
    color: var(--dark-modal-text);
}

[data-bs-theme="dark"] .swal2-popup .swal2-confirm {
    background: var(--dark-primary);
    border-color: var(--dark-primary);
    color: #fff;
}

[data-bs-theme="dark"] .swal2-popup .swal2-confirm:hover {
    background: var(--dark-secondary);
    border-color: var(--dark-secondary);
}

/* Stock Info Table Styles */
.stock-info-table {
    font-size: 0.9rem;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.stock-info-table th {
    background: var(--stock-info-bg);
    border-color: var(--stock-info-border);
    font-weight: 600;
    color: var(--text-primary);
}

.stock-info-table td {
    vertical-align: middle;
    border-color: var(--stock-info-border);
}

.quantity-available {
    color: var(--stock-available);
    font-weight: 600;
}

.quantity-zero {
    color: var(--stock-zero);
    font-weight: 600;
}

.quantity-low {
    color: var(--stock-low);
    font-weight: 600;
}

/* Dark mode stock info styles */
[data-bs-theme="dark"] .stock-info-table th {
    background: var(--dark-stock-info-bg);
    border-color: var(--dark-stock-info-border);
    color: var(--dark-text);
}

[data-bs-theme="dark"] .stock-info-table td {
    border-color: var(--dark-stock-info-border);
    color: var(--dark-text);
}

[data-bs-theme="dark"] .quantity-available {
    color: var(--dark-stock-available);
}

[data-bs-theme="dark"] .quantity-zero {
    color: var(--dark-stock-zero);
}

[data-bs-theme="dark"] .quantity-low {
    color: var(--dark-stock-low);
}

