/* تنسيقات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: #f5f6fa;
    color: #333;
    direction: rtl;
    transition: all 0.3s;
}

body.dark-mode {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* الشريط الجانبي */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: #2c3e50;
    color: white;
    padding: 20px 0;
    transition: all 0.3s;
    z-index: 1000;
}

.dark-mode .sidebar {
    background: #16213e;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.3rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-menu a.active {
    background: #3498db;
    color: white;
}

.sidebar-menu i {
    margin-left: 10px;
    font-size: 1.2rem;
}

/* المحتوى الرئيسي */
.main-content {
    margin-right: 260px;
    padding: 20px;
    min-height: 100vh;
    transition: all 0.3s;
}

/* شريط التنقل العلوي */
.navbar {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.dark-mode .navbar {
    background: #16213e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: 600;
}

.navbar-actions {
    display: flex;
    gap: 10px;
}

/* البطاقات */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.dark-mode .card {
    background: #16213e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.dark-mode .card-header {
    border-bottom-color: #2c3e50;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* النماذج */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

.dark-mode .form-control {
    background: #1a1a2e;
    border-color: #2c3e50;
    color: #e0e0e0;
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* الأزرار */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #d68910;
}

/* الجداول */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

.dark-mode .table th,
.dark-mode .table td {
    border-bottom-color: #2c3e50;
}

.table th {
    background: #2c3e50;
    font-weight: 600;
}

.dark-mode .table th {
    background: #1a1a2e;
}

.table-striped tbody tr:nth-child(odd) {
    background: 2c3e50;
}

.dark-mode .table-striped tbody tr:nth-child(odd) {
    background: #1a1a2e;
}

/* التبديل */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    right: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #3498db;
}

input:checked+.slider:before {
    transform: translateX(-26px);
}

/* علامات التبويب */
.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.dark-mode .tabs {
    border-bottom-color: #2c3e50;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab:hover {
    color: #3498db;
}

.tab.active {
    border-bottom-color: #3498db;
    color: #3498db;
    font-weight: 600;
}

/* التنبيهات */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.dark-mode .alert-success {
    background: #155724;
    color: #d4edda;
    border-color: #0c3d1a;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.dark-mode .alert-danger {
    background: #721c24;
    color: #f8d7da;
    border-color: #4a1418;
}

/* الصور المرفوعة */
.upload-preview {
    width: 100px;
    height: 100px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
}

/* الشبكة */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    flex: 1;
    padding: 0 10px;
    min-width: 300px;
}

.col-2 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 10px;
}

.col-3 {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    padding: 0 10px;
}

/* محرر الأكواد */
.code-editor {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    min-height: 200px;
}

/* مخصص لشاشات صغيرة */
@media (max-width: 768px) {
    .sidebar {
        right: -260px;
    }

    .sidebar.active {
        right: 0;
    }

    .main-content {
        margin-right: 0;
    }

    .navbar-actions {
        flex-direction: column;
        gap: 5px;
    }

    .col,
    .col-2,
    .col-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* تحسينات إدارة الأدوات */
.tool-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-icon {
    width: 35px;
    height: 35px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 1.2rem;
}

.dark-mode .tool-icon {
    background: #1a1a2e;
}

.tool-details {
    display: flex;
    flex-direction: column;
}

.tool-details strong {
    font-size: 14px;
    color: var(--primary-color);
}

.tool-details small {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.pinned-row {
    border-right: 4px solid #3498db !important;
    background: rgba(52, 152, 219, 0.05) !important;
}

/* Pagination Logic */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.page-link {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.page-link.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.dark-mode .page-link {
    background: #16213e;
    border-color: #2c3e50;
    color: #eee;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.bulk-actions-bar {
    background: #2c3e50;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark-mode .bulk-actions-bar {
    background: #0f172a;
}

.drag-handle {
    cursor: grab;
    color: #bbb;
    padding: 0 10px !important;
}

.drag-handle:active {
    cursor: grabbing;
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box i {
    position: absolute;
    right: 12px;
    top: 12px;
    color: #999;
}

.search-box input {
    padding-right: 35px !important;
}

/* Checkboxes */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============================================
   تحسينات إضافية للوحة التحكم 2026
============================================ */

/* Checkbox Container Modern */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 0;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #3498db;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: #cce5ff;
    color: #004085;
}

.dark-mode .badge-success {
    background: #155724;
    color: #d4edda;
}

.dark-mode .badge-danger {
    background: #721c24;
    color: #f8d7da;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 25px;
}

.dark-mode .modal-content {
    background: #1a1a2e;
}

.dark-mode .modal-header {
    background: linear-gradient(135deg, #16213e, #0f172a);
    border-bottom-color: #2c3e50;
}

.dark-mode .modal-body {
    color: #e0e0e0;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.stat-icon.success {
    background: linear-gradient(135deg, #27ae60, #219a52);
}

.stat-icon.warning {
    background: linear-gradient(135deg, #f39c12, #d68910);
}

.stat-icon.danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.stat-info h4 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.stat-info p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.dark-mode .stat-card {
    background: #16213e;
}

.dark-mode .stat-info p {
    color: #999;
}

/* Color Input Enhancement */
.color-input {
    height: 45px;
    padding: 5px;
    cursor: pointer;
}

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Secondary & Info Buttons */
.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

/* Grid Columns */
.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 10px;
}

.col-md-4 {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    padding: 0 10px;
}

.col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 10px;
}

.col-md-2 {
    flex: 0 0 16.666%;
    max-width: 16.666%;
    padding: 0 10px;
}

.col-md-1 {
    flex: 0 0 8.333%;
    max-width: 8.333%;
    padding: 0 10px;
}

.col-md-5 {
    flex: 0 0 41.666%;
    max-width: 41.666%;
    padding: 0 10px;
}

@media (max-width: 992px) {

    .col-md-6,
    .col-md-4,
    .col-md-3,
    .col-md-2,
    .col-md-1,
    .col-md-5 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
}

/* HR Separator */
hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 25px 0;
}

.dark-mode hr {
    border-top-color: #2c3e50;
}

/* Card Header with paragraph */
.card-header p {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: #666;
}

.dark-mode .card-header p {
    color: #999;
}

/* Section Headers */
h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h4 i {
    color: #3498db;
}

.dark-mode h4 {
    color: #e0e0e0;
}

/* Locked Row Styles */
.locked-row {
    background: rgba(231, 76, 60, 0.05) !important;
    border-right: 4px solid #e74c3c !important;
}

/* Text Colors */
.text-primary {
    color: #3498db !important;
}

.text-success {
    color: #27ae60 !important;
}

.text-danger {
    color: #e74c3c !important;
}

.text-warning {
    color: #f39c12 !important;
}

/* Textarea Enhancement */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.dashboard-header h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-mode .dashboard-header {
    border-bottom-color: #2c3e50;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.dark-mode .table-container {
    background: #16213e;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

.dark-mode .data-table th,
.dark-mode .data-table td {
    border-bottom-color: #2c3e50;
}

.data-table th {
    background: linear-gradient(135deg, #2c3e50, #e9ecef);
    font-weight: 600;
    font-size: 0.9rem;
}

.dark-mode .data-table th {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

/* Btn Edit/Delete */
.btn-edit {
    background: #f39c12;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-edit:hover {
    background: #d68910;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Sidebar Crown Icon (Pro) */
.sidebar-menu a i.fa-crown {
    color: #fbbf24;
}

/* Animation for saved message */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    10% {
        opacity: 1;
        transform: translateY(0);
    }

    90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.alert.saved-alert {
    animation: fadeInOut 4s ease forwards;
}