/* assets/style.css - تصميم داكن محسن مع عرض الشاشة الكاملة والأوقات الافتراضية المطورة */

:root {
  /* متغيرات الألوان الداكنة */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --bg-hover: #30363d;

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --border-primary: #30363d;
  --border-secondary: #21262d;

  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-orange: #ff8c69;
  --accent-red: #f85149;
  --accent-yellow: #d29922;
  --accent-purple: #a5a5ff;

  --shadow-main: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.2);

  --gradient-primary: linear-gradient(
    135deg,
    var(--accent-blue),
    var(--accent-purple)
  );
  --gradient-success: linear-gradient(135deg, var(--accent-green), #26a641);
  --gradient-warning: linear-gradient(
    135deg,
    var(--accent-orange),
    var(--accent-yellow)
  );
  --gradient-danger: linear-gradient(135deg, var(--accent-red), #da3633);
}

* {
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Helvetica, Arial, sans-serif;
  direction: rtl;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  overflow-x: hidden;
}

/* عرض كامل للشاشة */
.container {
  max-width: 100% !important;
  width: 100% !important;
  padding: 20px 30px;
  margin: 0;
  background: var(--bg-secondary);
  min-height: calc(100vh - 80px);
  border-radius: 0;
  box-shadow: none;
}

/* شريط التنقل */
.navbar {
  background: var(--bg-card) !important;
  border-bottom: 1px solid var(--border-primary);
  box-shadow: var(--shadow-light);
  padding: 1rem 0;
}

.navbar-brand {
  color: var(--accent-blue) !important;
  font-weight: 700;
  font-size: 1.4rem;
}

.navbar-nav .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem !important;
  border-radius: 6px;
  margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
  color: var(--accent-blue) !important;
  background: var(--bg-hover);
}

.navbar-nav .nav-link.active {
  color: var(--accent-blue) !important;
  background: var(--bg-hover);
}

.navbar-text {
  color: var(--text-secondary) !important;
}

/* العناوين والنصوص */
.header {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.header h1 {
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* البطاقات */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
  overflow: hidden;
}

.card-header {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.card-body {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 1.5rem;
}

/* النماذج */
.form-control,
.form-select {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-primary);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  background: var(--bg-secondary);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
  color: var(--text-primary);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-label {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* أزرار الصفحات */
.page-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding: 1rem;
  border: 2px solid var(--border-primary);
  border-radius: 10px;
  background: var(--bg-tertiary);
}

.page-buttons::-webkit-scrollbar {
  width: 6px;
}

.page-buttons::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.page-buttons::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 3px;
}

.btn-page {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--accent-blue);
  background: var(--bg-card);
  color: var(--accent-blue);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn-page:hover {
  background: var(--accent-blue);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-light);
}

.btn-page.selected {
  background: var(--accent-blue) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.4);
  transform: translateY(-2px);
}

/* الأزرار العامة */
.btn {
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(88, 166, 255, 0.4);
  color: white;
}

.btn-success {
  background: var(--gradient-success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(63, 185, 80, 0.4);
  color: white;
}

.btn-warning {
  background: var(--gradient-warning);
  color: white;
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 140, 105, 0.4);
  color: white;
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(248, 81, 73, 0.4);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, #17a2b8, #20c997);
  color: white;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-danger,
.btn-outline-secondary {
  background: transparent;
  border: 2px solid;
}

.btn-outline-primary {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-outline-primary:hover {
  background: var(--accent-blue);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* أزرار الأوقات الافتراضية المطورة */
.schedule-time-container {
  margin-top: 1rem;
}

.schedule-time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}

.schedule-time-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 120px;
  margin-bottom: 0;
}

.schedule-time-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.schedule-time-buttons .btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  border-width: 2px;
  min-width: auto;
  white-space: nowrap;
}

.schedule-time-buttons .btn i {
  margin-left: 4px;
  font-size: 0.75rem;
}

/* تأثير النقر على أزرار الأوقات */
.active-schedule-btn {
  transform: scale(0.95) !important;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

/* الجداول */
.table {
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}

.table thead th {
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
  border: none;
  padding: 1rem;
  font-size: 0.95rem;
}

.table tbody tr {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-primary);
  transition: all 0.3s ease;
}

.table tbody tr:hover {
  background: var(--bg-hover);
  transform: scale(1.01);
}

.table tbody td {
  padding: 1rem;
  border: none;
  vertical-align: middle;
  color: var(--text-primary);
}

/* التنبيهات */
.alert {
  border: none;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
  box-shadow: var(--shadow-light);
}

.alert-success {
  background: rgba(63, 185, 80, 0.1);
  color: var(--accent-green);
  border-left-color: var(--accent-green);
}

.alert-danger {
  background: rgba(248, 81, 73, 0.1);
  color: var(--accent-red);
  border-left-color: var(--accent-red);
}

.alert-warning {
  background: rgba(210, 153, 34, 0.1);
  color: var(--accent-yellow);
  border-left-color: var(--accent-yellow);
}

.alert-info {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

/* الشارات */
.badge {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  font-weight: 600;
}

.badge.bg-primary {
  background: var(--accent-blue) !important;
}

.badge.bg-success {
  background: var(--accent-green) !important;
}

.badge.bg-warning {
  background: var(--accent-yellow) !important;
}

.badge.bg-danger {
  background: var(--accent-red) !important;
}

.badge.bg-info {
  background: #17a2b8 !important;
}

.badge.bg-secondary {
  background: var(--text-muted) !important;
}

/* مؤشر التحميل */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(88, 166, 255, 0.3);
  border-top: 3px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* حالات المنشورات */
.status-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.status-scheduled {
  background: rgba(210, 153, 34, 0.2);
  color: var(--accent-yellow);
}

.status-processing {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent-blue);
}

/* بطاقات الإحصائيات */
.stats-card {
  text-align: center;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
}

.stats-card.primary {
  background: var(--gradient-primary);
  color: white;
}

.stats-card.success {
  background: var(--gradient-success);
  color: white;
}

.stats-card.warning {
  background: var(--gradient-warning);
  color: white;
}

/* مؤشرات النظام */
.system-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 8px;
}

.system-indicator.online {
  background-color: var(--accent-green);
  animation: pulse 2s infinite;
}

.system-indicator.offline {
  background-color: var(--accent-red);
}

.system-indicator.warning {
  background-color: var(--accent-yellow);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(63, 185, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0);
  }
}

/* إحصائيات التوكنات */
.token-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.token-stat-item {
  text-align: center;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 2px solid var(--border-primary);
  transition: all 0.3s ease;
}

.token-stat-item:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.token-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-blue);
  display: block;
}

.token-stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* تأثيرات الظهور */
.fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تنسيق صفحة تسجيل الدخول */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  box-shadow: var(--shadow-main);
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h2 {
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.form-floating .form-control {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-primary);
  color: var(--text-primary);
}

.form-floating .form-control:focus {
  background: var(--bg-secondary);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-floating label {
  color: var(--text-muted);
}

.form-check-input {
  background-color: var(--bg-tertiary);
  border-color: var(--border-primary);
}

.form-check-input:checked {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.form-check-label {
  color: var(--text-secondary);
}

.btn-login {
  width: 100%;
  padding: 0.875rem;
  font-weight: 700;
  background: var(--gradient-primary);
  border: none;
  border-radius: 10px;
  color: white;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(88, 166, 255, 0.4);
  color: white;
}

.alert-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--accent-red);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.alert-success {
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--accent-green);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

/* Modal */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
}

.modal-header {
  background: var(--gradient-primary);
  color: white;
  border: none;
}

.modal-body {
  background: var(--bg-card);
}

.modal-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-primary);
}

.btn-close {
  filter: invert(1);
}

/* تحسينات للشاشات الكبيرة */
@media (min-width: 1400px) {
  .container {
    padding: 20px 40px;
  }

  .schedule-time-buttons .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .token-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (min-width: 1600px) {
  .container {
    padding: 20px 60px;
  }

  .header h1 {
    font-size: 3rem;
  }

  .schedule-time-buttons .btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
}

/* تجاوبية الجهاز المحمول */
@media (max-width: 768px) {
  .container {
    padding: 15px 20px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .page-buttons {
    max-height: 200px;
  }

  .btn-page {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .table-responsive {
    font-size: 0.875rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
  }

  .login-card {
    margin: 1rem;
    padding: 2rem 1.5rem;
  }

  .schedule-time-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .schedule-time-label {
    min-width: auto;
  }

  .schedule-time-buttons {
    width: 100%;
    justify-content: flex-start;
  }

  .schedule-time-buttons .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .token-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .token-stat-item {
    padding: 0.75rem;
  }

  .token-stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 576px) {
  .schedule-time-buttons .btn {
    padding: 4px 6px;
    font-size: 0.7rem;
    min-width: auto;
  }

  .schedule-time-buttons .btn i {
    display: none; /* إخفاء الأيقونات في الشاشات الصغيرة جداً */
  }
}

/* شريط التمرير المخصص للمتصفحات Webkit */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4f8fff;
}

/* تحسين إمكانية الوصول */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* تحسين التنقل بالكيبورد */
.btn:focus,
.form-control:focus,
.form-select:focus,
.btn-page:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* تحسين حالة التركيز للوصولية */
*:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* إخفاء outline للنقر بالماوس فقط */
*:focus:not(:focus-visible) {
  outline: none;
}

/* تأثيرات hover للأجهزة التي تدعمها */
@media (hover: hover) {
  .btn:hover,
  .btn-page:hover,
  .card:hover {
    transform: translateY(-2px);
  }
}

/* تحسينات للطباعة */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  .navbar,
  .btn,
  .alert,
  .schedule-time-container {
    display: none !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .table th,
  .table td {
    border: 1px solid #000 !important;
  }
}

/* تأثيرات خاصة للعناصر التفاعلية */
.btn:active {
  transform: scale(0.98);
}

.btn-page:active {
  transform: scale(0.95);
}

/* تحسين النصوص */
.text-truncate {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-primary {
  color: var(--text-primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

/* خلفيات مخصصة */
.bg-primary {
  background: var(--accent-blue) !important;
}

.bg-secondary {
  background: var(--bg-secondary) !important;
}

.bg-dark {
  background: var(--bg-primary) !important;
}

/* حدود مخصصة */
.border-primary {
  border-color: var(--border-primary) !important;
}

.border-secondary {
  border-color: var(--border-secondary) !important;
}

/* تحسينات إضافية للتفاعل */
.card-header:hover {
  background: linear-gradient(135deg, #4f8fff, #9a9aff);
}
