/* Custom CSS for Inventory Management System */

/* RTL Support */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: right;
    margin: 0;
    padding: 0;
}

/* Layout Fix - Main Content Area */
.container-fluid {
    padding-right: 0;
    padding-left: 0;
}

.row {
    margin-right: 0;
    margin-left: 0;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    width: 280px;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 72px;
}

/* Main Content Adjustment for Sidebar */
.main-content,
main.col-md-9,
main.col-lg-10,
.content-wrapper,
.col-md-9.ms-sm-auto,
.col-lg-10.ms-sm-auto {
    margin-right: 280px !important;
    margin-left: 0 !important;
    width: calc(100% - 280px) !important;
    max-width: calc(100% - 280px) !important;
    min-height: 100vh;
    padding: 20px 30px;
    float: none !important;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When sidebar is collapsed */
body.sidebar-collapsed .main-content,
body.sidebar-collapsed main.col-md-9,
body.sidebar-collapsed main.col-lg-10,
body.sidebar-collapsed .content-wrapper,
body.sidebar-collapsed .col-md-9.ms-sm-auto,
body.sidebar-collapsed .col-lg-10.ms-sm-auto,
.sidebar.collapsed ~ .main-content,
.sidebar.collapsed + .main-content {
    margin-right: 72px !important;
    width: calc(100% - 72px) !important;
    max-width: calc(100% - 72px) !important;
}

/* Container fixes */
.container-fluid > .row {
    display: flex;
    flex-wrap: wrap;
}

/* Responsive Layout */

/* موبايل */
@media (max-width: 768px) {
    .main-content,
    main.col-md-9,
    main.col-lg-10,
    .content-wrapper,
    .col-md-9.ms-sm-auto,
    .col-lg-10.ms-sm-auto {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px !important;
    }
}

/* تابلت */
@media (min-width: 769px) and (max-width: 1199px) {
    .sidebar {
        width: 72px;
    }

    .main-content,
    main.col-md-9,
    main.col-lg-10,
    .content-wrapper,
    .col-md-9.ms-sm-auto,
    .col-lg-10.ms-sm-auto {
        margin-right: 72px !important;
        margin-left: 0 !important;
        width: calc(100% - 72px) !important;
        max-width: calc(100% - 72px) !important;
        padding: 15px 20px;
    }
}




/* Dashboard Cards */
.card {
    transition: all 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.card-header {
    border-radius: 8px 8px 0 0;
    font-weight: bold;
}

/* Tables */
.table th {
    font-weight: bold;
    background-color: #f8f9fa;
}

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

/* Product Thumbnails */
.product-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

/* Form Controls */
.form-control:focus, .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

/* Buttons */
.btn {
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* Footer */
footer {
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Invoice Styles */
.invoice-container {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-title {
        font-size: 1.1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    /* إخفاء عناصر الواجهة غير المطلوبة في الطباعة */
    nav.navbar,
    .navbar,
    .sidebar,
    .page-header .btn,
    .btn-group,
    button.btn {
        display: none !important;
    }

    /* استخدام كامل عرض الصفحة عند الطباعة (إزالة إزاحة القائمة الجانبية) */
    .main-content,
    main.col-md-9,
    main.col-lg-10,
    .content-wrapper,
    .col-lg-10.ms-sm-auto {
        margin-right: 0 !important;
        margin-left: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }

    .container-fluid {
        width: 100%;
        padding: 0;
    }

    body {
        background-color: white !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    /* الجداول تظهر بوضوح في الطباعة */
    table { width: 100% !important; border-collapse: collapse !important; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
}

/* Custom Badge Colors */
.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-primary {
    background-color: #0d6efd !important;
}

/* Custom Form Validation Styles */
.was-validated .form-control:invalid {
    border-color: #dc3545;
    padding-left: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:valid {
    border-color: #198754;
    padding-left: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* RTL Specific Adjustments */
.dropdown-menu-end {
    left: 0;
    right: auto;
}

.me-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

.me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

.me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}
