/* ============================================================
   base.css — الإعدادات الأساسية المشتركة لكل الصفحات
   يُستورَد بعد variables.css مباشرةً
   ============================================================ */

/* ===== Reset ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    color: var(--text-light);
    background: #050a14;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    direction: rtl;
}

/* ===== شريط التمرير ===== */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* ===== تحديد النص ===== */
::selection      { background: rgba(102, 126, 234, 0.3); color: white; }
::-moz-selection { background: rgba(102, 126, 234, 0.3); color: white; }

/* ===== خط الفاصل ===== */
hr {
    border: none;
    height: 1px;
    background: linear-gradient(to left, transparent, var(--border-gray-600), transparent);
    margin: 1rem 0;
}

/* ===== حالات الخطأ والتحميل ===== */
.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    color: #f8d7da;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 2px solid #fff;
    animation: spin 1s linear infinite;
}

.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

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

/* ===== تأثيرات الظهور ===== */
.animate-fade-in {
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Focus لإمكانية الوصول ===== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== تحسينات اللمس ===== */
.btn, .nav-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: none) and (pointer: coarse) {
    .btn:hover, .nav-link:hover { transform: none; }
    .btn:active, .nav-link:active { transform: scale(0.98); }
}

/* ===== safe-area للأجهزة المثقوبة (notch) ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }
}

/* ===== مساعد overflow للجداول ===== */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* ===== input[type=file] ===== */
input[type="file"] { color: #e5e7eb; }
input[type="file"]::file-selector-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
input[type="file"]::file-selector-button:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: #3b82f6;
}

/* ===== طباعة ===== */
@media print {
    .btn-primary, .btn-secondary { display: none; }
    .bg-gray-800, .bg-gray-700  { background-color: white !important; color: black !important; }
    .text-white, .text-gray-300 { color: black !important; }
    .border { border-color: #ccc !important; }
}