:root {
    --primary-color: #1b7983;
    --secondary-color: #ffffff;
    --accent-color: #1b7983;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', 'Tahoma', sans-serif;
    background-color: var(--secondary-color);
    color: #333;
    line-height: 1.6;
}

body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--primary-color);
    color: white;
    overflow-y: auto;
    transition: width 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-menu a span {
    display: none;
}

.sidebar.collapsed .sidebar-header span {
    display: none;
}

.sidebar-header {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.2s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu a i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar.collapsed .sidebar-menu a i {
    margin: 0;
}

.menu-group {
    margin: 15px 0;
}

.menu-group-title {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
}

.sidebar.collapsed .menu-group-title {
    display: none;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px 0;
}

/* Main Content */
.main-content {
    margin-right: 250px;
    transition: margin-right 0.3s ease;
    min-height: 100vh;
}

.sidebar.collapsed~.main-content {
    margin-right: 60px;
}

/* Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    right: 250px;
    left: 0;
    background-color: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    z-index: 999;
    transition: right 0.3s ease;
}

.sidebar.collapsed~.main-content .top-bar {
    right: 60px;
}

.top-bar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
    direction: ltr;
}

.top-bar-logo img {
    max-height: 40px;
    max-width: 150px;
}

.top-bar-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Content Area */
.content {
    padding: 30px;
    margin-top: 70px;
    /* Account for fixed top bar */
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #155a63;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(27, 121, 131, 0.1);
}

.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f5f5f5;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
}

.stat-card-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Search and Filters */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
    flex: 1;
    min-width: 200px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #333;
}

/* Utilities */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 10px;
}

.mt-2 {
    margin-top: 20px;
}

.mt-3 {
    margin-top: 30px;
}

.mb-1 {
    margin-bottom: 10px;
}

.mb-2 {
    margin-bottom: 20px;
}

.mb-3 {
    margin-bottom: 30px;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 {
    gap: 10px;
}

.gap-2 {
    gap: 20px;
}

/* Print Styles */
@media print {

    .sidebar,
    .top-bar,
    .btn,
    .search-bar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .content {
        padding: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        margin-right: 0;
    }

    .top-bar {
        right: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}