body {
    direction: rtl;
    text-align: right;
    font-family: 'Tajawal', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    background: #f4f7f6;
}

.main-wrapper {
    display: flex;
    width: 100%;
}

/* Sidebar Styles - Soft Hoor Identity */
.sidebar {
    width: 280px;
    background: #1a237e; /* الأزرق الملكي */
    color: #fff;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    overflow-y: auto;
    border-left: #ffc107 3px solid; /* الذهبي */
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background: #0d1240;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h1 {
    font-size: 18px;
    margin: 10px 0 0 0;
    color: #fff;
    font-weight: 700;
}

.sidebar-header img {
    height: 60px;
    margin-bottom: 5px;
}

.content-area {
    flex: 1;
    margin-right: 280px;
    padding: 20px;
    width: calc(100% - 280px);
}

.container {
    width: 95%;
    margin: auto;
}

/* Tree Menu Styles */
.tree-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.tree-item {
    padding: 0;
}

.tree-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    transition: 0.3s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 16px; 
}

.tree-link:hover {
    background: #ffc107;
    color: #1a237e;
    font-weight: bold;
}

.tree-link i, .tree-link span.icon {
    margin-left: 10px;
    font-size: 20px; 
}

.tree-category {
    cursor: pointer;
    background: rgba(0,0,0,0.2);
    font-weight: bold;
}

.tree-category::after {
    content: '-';
    order: -1;
    margin-left: 10px;
    margin-right: 0;
    transition: 0.3s;
    font-size: 20px;
    font-weight: bold;
}

.tree-category.collapsed::after {
    content: '+';
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0,0,0,0.1);
    display: block;
}

.submenu.hidden {
    display: none;
}

.submenu .tree-link {
    padding-right: 40px;
    font-size: 14px; 
    background: transparent;
}

.submenu .tree-link:hover {
    background: rgba(255,255,255,0.1);
    color: #ffc107;
}

.card {
    background: #fff;
    padding: 20px;
    margin-top: 20px;
    border-radius: 10px;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    justify-content: flex-start;
}

.stats-card {
    flex: 1 1 280px;
    min-width: 250px;
    max-width: 350px;
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    color: #fff;
    transition: transform 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.stats-card p {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

.stats-card.primary { background: #1a237e; }
.stats-card.success { background: #27ae60; }
.stats-card.warning { background: #f39c12; }
.stats-card.info { background: #2980b9; }
.stats-card.teal { background: #16a085; }
.stats-card.orange { background: #d35400; }
.stats-card.purple { background: #9b59b6; }
.stats-card.danger { background: #e74c3c; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    box-sizing: border-box;
    border-radius: 6px;
}

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #1a237e;
    color: #fff;
    border: none;
    cursor: pointer;
    text-decoration: none;
    gap: 6px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #0d1240;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn .icon {
    font-size: 16px;
}

.btn-success { background: #27ae60; }
.btn-primary { background: #2980b9; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-danger { background: #e74c3c; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
}

table th, table td {
    border: 1px solid #eee;
    padding: 12px;
    text-align: right;
}

table th {
    background-color: #1a237e;
    color: white;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar { width: 240px; }
    .content-area { margin-right: 240px; width: calc(100% - 240px); }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar {
        position: fixed;
        right: -100%;
        transition: right 0.3s ease;
        width: 280px;
        z-index: 2000;
    }
    .sidebar.active { right: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 1500;
    }
    .sidebar-overlay.active { display: block; }
    .content-area { margin-right: 0; width: 100%; padding: 10px; }
    .container { width: 100%; }
    .mobile-menu-btn {
        display: block;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 3000;
        background: #1a237e;
        color: #fff;
        border: none;
        padding: 10px 15px;
        font-size: 20px;
        cursor: pointer;
        border-radius: 5px;
    }
}
    
    .stats-grid {
        gap: 15px;
    }
    
    .stats-card {
        flex: 1 1 calc(50% - 15px);
        min-width: 200px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 15px;
    }
    
    table th, table td {
        padding: 8px 6px;
        font-size: 14px;
    }
    
    .stats-grid {
        gap: 10px;
    }
    
    .stats-card {
        flex: 1 1 100%;
        min-width: auto;
        padding: 15px;
    }
    
    .stats-card h3 {
        font-size: 14px;
    }
    
    .stats-card p {
        font-size: 22px;
    }
}
