/* Main CSS - RTL Support */

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    background-color: #f8f9fa;
    color: #333;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
}

/* Sidebar */
.sidebar {
    background-color: #343a40;
    min-height: calc(100vh - 56px);
    padding: 20px 0;
    position: sticky;
    top: 56px;
    z-index: 100;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-container {
    padding-right: 0;
}

.sidebar .nav {
    padding: 0;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    border-right: 4px solid transparent;
    transition: all 0.3s;
    font-weight: 600;
}

.sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.05);
    border-right-color: #007bff;
    color: #fff;
    padding-right: 25px; /* Slide effect */
}

.sidebar .nav-link.active {
    background-color: rgba(0, 123, 255, 0.1);
    border-right-color: #007bff;
    color: #fff;
}

.sidebar .nav-link i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    padding: 20px;
    min-height: calc(100vh - 56px);
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    border-radius: 8px;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.stats-card.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stats-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stats-card.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stats-card .stats-icon {
    font-size: 3rem;
    opacity: 0.8;
}

.stats-card .stats-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
}

.stats-card .stats-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Tables */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 700;
    color: #495057;
    text-align: right;
    border-top: none;
}

.table td {
    vertical-align: middle;
    border-top: 1px solid #f1f1f1;
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.2s;
}

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

.btn-sm {
    padding: 5px 12px;
    font-size: 0.85rem;
}

/* Forms */
.form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 10px 15px;
    height: auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

/* Sidebar Close Button */
.sidebar-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    transition: background-color 0.3s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-close:focus {
    outline: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    font-size: 1.25rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: none;
}

.sidebar-toggle:hover {
    opacity: 0.8;
    color: #fff !important;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar-container {
        display: block !important;
        position: static;
        width: 0;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible;
    }
    
    .sidebar {
        position: fixed !important;
        top: 56px;
        right: -280px;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 1000;
        transition: right 0.3s ease-in-out;
        overflow-y: auto;
        box-shadow: -2px 0 10px rgba(0,0,0,0.3);
        padding-top: 50px;
        display: block !important;
    }
    
    .sidebar.show {
        right: 0 !important;
    }
    
    .main-content {
        padding: 10px;
        width: 100%;
        margin-left: 0 !important;
    }
    
    .stats-card {
        padding: 12px;
    }
    
    .stats-card .stats-value {
        font-size: 1.25rem;
    }

    .stats-card .stats-icon {
        font-size: 2rem;
    }

    .stats-card .stats-label {
        font-size: 0.85rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .shortcut-buttons {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px;
    }
    
    .shortcut-btn {
        padding: 10px 5px;
    }
    
    .shortcut-btn i {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .shortcut-btn span {
        font-size: 0.7rem;
        display: block;
        line-height: 1.2;
    }
    
    .sidebar .nav-link {
        padding: 15px 20px;
        font-size: 1rem;
    }
}

/* Shortcut Buttons */
.shortcut-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.shortcut-btn {
    padding: 15px;
    text-align: center;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.shortcut-btn:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
    color: #007bff;
    text-decoration: none;
}

.shortcut-btn i {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Image Preview */
.img-preview {
    max-width: 100px;
    max-height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

/* Badge */
.badge {
    padding: 5px 10px;
    border-radius: 5px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Item Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.item-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

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

.item-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.item-card-body {
    padding: 15px;
}

/* RTL Fixes */
.dropdown-menu {
    right: 0;
    left: auto;
}

.modal-header .close {
    margin: -1rem auto -1rem -1rem;
}

/* Button Group RTL */
.btn-group > .btn:not(:first-child),
.btn-group > .btn-group:not(:first-child) {
    margin-right: -1px;
    margin-left: 0;
}

.btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-group > .btn:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group > .btn:first-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.btn-group > .btn:last-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

/* Print Styles */
@media print {
    .sidebar, .navbar, .btn, .no-print {
        display: none !important;
    }
    
    .main-content {
        width: 100%;
        padding: 0;
    }
}

