/* ============================================
   MEGA GRAY THEME - ثيم رمادي موحّد
   النظام: أبيض + رماديات + أسود فقط
   ============================================ */

/* ============================================
   VARIABLES - المتغيرات
   ============================================ */
:root {
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --black: #000000;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--white) !important;
    color: var(--gray-900) !important;
    line-height: 1.6;
    direction: rtl;
    padding-top: 100px;
}

/* ============================================
   HEADER - رمادي فاتح ثابت
   ============================================ */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--gray-100) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border-bottom: 1px solid var(--gray-300);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    height: 70px;
}

/* إخفاء كل الأيقونات والإيموجي */
.logo-icon,
.nav-icon,
.user-avatar,
.notification-badge,
.action-btn svg,
.mobile-menu-btn svg,
.user-btn svg,
i,
.icon,
.fa,
.fas,
.far,
.fab,
.icon-btn,
img.icon,
.emoji-icon {
    display: none !important;
}

/* Brand/Logo */
.brand-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--gray-900) !important;
    transition: all 0.3s;
}

.brand-link:hover {
    color: var(--gray-700) !important;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--gray-900) !important;
}

.brand-tagline {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600) !important;
}

/* Navigation */
.header-nav {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700) !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: transparent;
}

.nav-link:hover {
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
}

.nav-link.active {
    background: var(--gray-300) !important;
    color: var(--gray-900) !important;
    border-bottom: 2px solid var(--gray-600);
}

.nav-text {
    white-space: nowrap;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: var(--white) !important;
    color: var(--gray-700) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--gray-100) !important;
    border-color: var(--gray-400);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--white) !important;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    color: var(--gray-900) !important;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.user-btn:hover {
    background: var(--gray-50) !important;
    border-color: var(--gray-400);
}

.user-name {
    font-size: 0.95rem;
    color: var(--gray-900) !important;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: var(--white) !important;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--gray-700) !important;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border-bottom: 1px solid var(--gray-200);
}

.dropdown-item:first-child {
    border-radius: 4px 4px 0 0;
}

.dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 4px 4px;
}

.dropdown-item:hover {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-300);
    margin: 0.5rem 0;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ============================================
   CARDS
   ============================================ */
.card,
.form-container,
.table-container {
    background: var(--white) !important;
    color: var(--gray-900) !important;
    border-radius: 4px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-300);
}

.card-header,
.section-header,
h1, h2, h3, h4, h5, h6 {
    color: var(--gray-900) !important;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* ============================================
   TABLES - جداول رمادية مع حدود واضحة
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white) !important;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    overflow: hidden;
}

table thead {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
}

table thead th {
    padding: 1rem;
    text-align: right;
    font-weight: 700;
    color: var(--gray-900) !important;
    border-bottom: 2px solid var(--gray-300);
    border-right: 1px solid var(--gray-300);
}

table thead th:first-child {
    border-right: none;
}

table tbody {
    background: var(--white) !important;
}

table tbody tr {
    border-bottom: 1px solid var(--gray-300);
    transition: all 0.2s;
}

table tbody tr:hover {
    background: var(--gray-50) !important;
}

table tbody td {
    padding: 1rem;
    color: var(--gray-900) !important;
    text-align: right;
    border-right: 1px solid var(--gray-200);
}

table tbody td:first-child {
    border-right: none;
}

/* ============================================
   BUTTONS - مربعة بنص عربي واضح
   ============================================ */
.btn,
.btn-sm,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
button[type="submit"],
button[type="button"],
a.button {
    padding: 0.75rem 1.5rem !important;
    border-radius: 4px !important;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    border: 1px solid var(--gray-400) !important;
    cursor: pointer;
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
}

.btn:hover,
.btn-sm:hover,
button:hover {
    background: var(--gray-200) !important;
    border-color: var(--gray-500) !important;
    color: var(--gray-900) !important;
}

.btn-sm {
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--gray-700) !important;
    color: var(--white) !important;
    border-color: var(--gray-700) !important;
}

.btn-primary:hover {
    background: var(--gray-800) !important;
    border-color: var(--gray-800) !important;
    color: var(--white) !important;
}

.btn-success {
    background: var(--gray-600) !important;
    color: var(--white) !important;
    border-color: var(--gray-600) !important;
}

.btn-success:hover {
    background: var(--gray-700) !important;
    border-color: var(--gray-700) !important;
    color: var(--white) !important;
}

.btn-danger {
    background: var(--gray-500) !important;
    color: var(--white) !important;
    border-color: var(--gray-500) !important;
}

.btn-danger:hover {
    background: var(--gray-600) !important;
    border-color: var(--gray-600) !important;
    color: var(--white) !important;
}

.btn-secondary {
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
    border-color: var(--gray-300) !important;
}

.btn-secondary:hover {
    background: var(--gray-300) !important;
    border-color: var(--gray-400) !important;
}

/* ============================================
   FORMS - حقول مربعة
   ============================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.75rem !important;
    border: 1px solid var(--gray-300) !important;
    border-radius: 4px !important;
    background: var(--white) !important;
    color: var(--gray-900) !important;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400) !important;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gray-500) !important;
    box-shadow: 0 0 0 3px var(--gray-100);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    padding-left: 3rem !important;
}

/* Form Labels */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-900) !important;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* ============================================
   MODALS - مودالات رمادية
   ============================================ */
.modal,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content,
.modal-dialog,
.modal-body {
    background: var(--white) !important;
    color: var(--gray-900) !important;
    border-radius: 4px !important;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--gray-300);
}

.modal-header {
    border-bottom: 2px solid var(--gray-300);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-title {
    color: var(--gray-900) !important;
    font-weight: 700;
    font-size: 1.5rem;
}

.modal-footer {
    border-top: 2px solid var(--gray-300);
    padding-top: 1rem;
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.close,
.modal-close {
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.close:hover,
.modal-close:hover {
    background: var(--gray-300) !important;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
    font-weight: 600;
}

.alert-success,
.alert-error,
.alert-info,
.alert-warning {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
    border-color: var(--gray-400);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
    text-decoration: none;
    border: 1px solid var(--gray-300);
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--gray-200) !important;
    border-color: var(--gray-400);
}

.pagination .active {
    background: var(--gray-700) !important;
    color: var(--white) !important;
    border-color: var(--gray-700);
    font-weight: 700;
}

/* ============================================
   BADGES
   ============================================ */
.badge,
.tag,
.status {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
    border: 1px solid var(--gray-400);
}

.badge-success {
    background: var(--gray-600) !important;
    color: var(--white) !important;
    border-color: var(--gray-600);
}

.badge-warning {
    background: var(--gray-400) !important;
    color: var(--white) !important;
    border-color: var(--gray-400);
}

.badge-danger {
    background: var(--gray-500) !important;
    color: var(--white) !important;
    border-color: var(--gray-500);
}

.badge-info {
    background: var(--gray-300) !important;
    color: var(--gray-900) !important;
    border-color: var(--gray-400);
}

.badge-primary {
    background: var(--gray-700) !important;
    color: var(--white) !important;
    border-color: var(--gray-700);
}

/* ============================================
   LINKS
   ============================================ */
a {
    color: var(--gray-700) !important;
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--gray-900) !important;
    text-decoration: underline;
}

/* ============================================
   STATS/CARDS DASHBOARD
   ============================================ */
.stat-card,
.dashboard-card,
.info-card {
    background: var(--white) !important;
    color: var(--gray-900) !important;
    border-radius: 4px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-300);
    transition: all 0.2s;
}

.stat-card:hover,
.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--gray-400);
}

.stat-value,
.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900) !important;
}

.stat-label,
.card-label {
    font-size: 1rem;
    color: var(--gray-600) !important;
}

/* ============================================
   TABS
   ============================================ */
.tabs,
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--gray-300);
    margin-bottom: 2rem;
}

.tab,
.nav-tab,
.tab-link {
    padding: 0.75rem 1.5rem;
    border-radius: 4px 4px 0 0;
    background: var(--gray-100) !important;
    color: var(--gray-700) !important;
    border: 1px solid var(--gray-300);
    border-bottom: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 600;
}

.tab:hover,
.nav-tab:hover {
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
}

.tab.active,
.nav-tab.active {
    background: var(--white) !important;
    color: var(--gray-900) !important;
    border-bottom: 2px solid var(--white);
}

/* ============================================
   LISTS
   ============================================ */
ul, ol {
    color: var(--gray-900) !important;
    padding-right: 2rem;
}

li {
    color: var(--gray-900) !important;
    margin-bottom: 0.5rem;
}

/* ============================================
   SIDEBAR (if exists)
   ============================================ */
.sidebar,
.side-nav {
    background: var(--gray-50) !important;
    color: var(--gray-900) !important;
    border-left: 1px solid var(--gray-300);
    padding: 2rem;
}

.sidebar a,
.side-nav a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--gray-700) !important;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.sidebar a:hover,
.side-nav a:hover {
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
    text-decoration: none;
}

.sidebar a.active,
.side-nav a.active {
    background: var(--gray-300) !important;
    color: var(--gray-900) !important;
    font-weight: 700;
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--gray-600) !important;
}

.breadcrumb-item {
    color: var(--gray-600) !important;
}

.breadcrumb-item:not(:last-child)::after {
    content: "/";
    margin-right: 0.5rem;
    color: var(--gray-400);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 6px;
    border: 2px solid var(--gray-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner,
.loader {
    border: 4px solid var(--gray-300);
    border-top: 4px solid var(--gray-700);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: var(--white) !important;
    color: var(--gray-900) !important;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1024px) {
    .nav-text {
        display: inline !important;
    }
    
    .nav-link {
        padding: 0.75rem 1.25rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .header-nav {
        position: fixed;
        top: 70px;
        right: 0;
        left: 0;
        background: var(--gray-50) !important;
        flex-direction: column;
        gap: 0;
        padding: 1rem;
        transform: translateX(100%);
        transition: transform 0.3s;
        border-top: 1px solid var(--gray-300);
    }
    
    .header-nav.active {
        transform: translateX(0);
    }
    
    .nav-link {
        width: 100%;
        padding: 1rem;
        justify-content: flex-start;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    .btn,
    .btn-sm {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 1rem;
        gap: 1rem;
    }
    
    .brand-name {
        font-size: 1.25rem;
    }
    
    table thead th,
    table tbody td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   DARK MODE OVERRIDE - تجاهل Dark Mode
   ============================================ */
body.dark-mode {
    background: var(--white) !important;
    color: var(--gray-900) !important;
}

body.dark-mode * {
    color: var(--gray-900) !important;
}

body.dark-mode .card,
body.dark-mode .form-container,
body.dark-mode .table-container,
body.dark-mode .modal-content {
    background: var(--white) !important;
    color: var(--gray-900) !important;
}

/* ============================================
   UI COMPONENTS OVERRIDE
   ============================================ */
.ui-table-container {
    background: var(--white) !important;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
}

.ui-table thead {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
}

.ui-table thead th {
    color: var(--gray-900) !important;
    border-bottom: 2px solid var(--gray-300);
}

.ui-table tbody tr {
    border-bottom: 1px solid var(--gray-300);
}

.ui-table tbody tr:hover {
    background: var(--gray-50) !important;
}

.ui-table tbody td {
    color: var(--gray-900) !important;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* ============================================
   SPECIFIC OVERRIDES
   ============================================ */
.page-title {
    color: var(--gray-900) !important;
}

.stat-card.danger,
.stat-card.warning,
.stat-card.info {
    border-right: 4px solid var(--gray-500);
}

.filters-card,
.bulk-actions {
    background: var(--gray-50) !important;
    border: 1px solid var(--gray-300);
}

/* ============================================
   END OF MEGA GRAY THEME
   ============================================ */

