/* =====================================================
   نظام إصدار التذاكر المتكامل - الأنماط الموحدة
   تصميم مستوحى من Zoho Desk
   ===================================================== */

/* ===== متغيرات الألوان ===== */
:root {
  --sidebar-bg: #1e2a3a;
  --sidebar-hover: #2d3f55;
  --sidebar-active: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #2d3f55;

  --header-bg: #ffffff;
  --header-border: #e2e8f0;
  --header-shadow: 0 1px 4px rgba(0,0,0,0.08);

  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
  --card-border: #e2e8f0;
  --card-radius: 10px;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0ea5e9;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;

  --text-dark: #1e293b;
  --text-medium: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;

  --status-open: #3b82f6;
  --status-open-bg: #eff6ff;
  --status-inprogress: #f59e0b;
  --status-inprogress-bg: #fffbeb;
  --status-pending: #6b7280;
  --status-pending-bg: #f3f4f6;
  --status-resolved: #10b981;
  --status-resolved-bg: #ecfdf5;
  --status-closed: #374151;
  --status-closed-bg: #f9fafb;

  --priority-p1: #ef4444;
  --priority-p1-bg: #fef2f2;
  --priority-p2: #f97316;
  --priority-p2-bg: #fff7ed;
  --priority-p3: #f59e0b;
  --priority-p3-bg: #fffbeb;
  --priority-p4: #6b7280;
  --priority-p4-bg: #f3f4f6;

  --sidebar-width: 240px;
  --header-height: 64px;
  --transition: all 0.2s ease;
  --radius: 8px;
  --radius-lg: 12px;

  /* ألوان المناصب */
  --admin-color: #3d6b3e;
  --support-color: #8b7a3e;
}

/* ===== إعادة الضبط ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Cascadia Mono SemiBold', 'Cascadia Mono', 'Cascadia Code', 'Consolas', monospace, 'Segoe UI Arabic', Tahoma, Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--main-bg);
  line-height: 1.6;
  direction: rtl;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* =====================================================
   صفحة تسجيل الدخول
   ===================================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(-45deg, #1e2a3a, #2d3f55, #1e3a5f, #0c2e2e, #1a1a2e);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  padding: 1rem;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.8rem;
}

.login-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
}

.login-logo p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-form label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-medium);
}

.login-form input {
  padding: 0.7rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: var(--transition);
  background: #fafafa;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-btn {
  padding: 0.8rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 0.5rem;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
  background: var(--danger-light);
  border-radius: var(--radius);
  display: none;
}

.login-error.show {
  display: block;
}

.login-demo {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.login-demo p {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.demo-credentials {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.demo-credentials span {
  font-size: 0.8rem;
  color: var(--text-medium);
  text-align: center;
}

.demo-credentials strong {
  color: var(--primary);
}

/* =====================================================
   تخطيط الصفحة الرئيسي (Portal Layout)
   ===================================================== */

.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== الشريط الجانبي ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-logo .logo-text small {
  display: block;
  font-size: 0.7rem;
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
}

.user-info .user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .user-role {
  font-size: 0.75rem;
  color: var(--sidebar-text);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 1.25rem 0.25rem;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: right;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(59,130,246,0.15);
  color: var(--sidebar-text-active);
  border-right: 3px solid var(--sidebar-active);
}

.nav-item .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 0.75rem 0;
  border-top: 1px solid var(--sidebar-border);
}

/* ===== المحتوى الرئيسي ===== */
.main-wrapper {
  margin-right: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== رأس الصفحة ===== */
.portal-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  transition: var(--transition);
}

.header-btn.primary {
  background: var(--primary);
  color: white;
}

.header-btn.primary:hover {
  background: var(--primary-hover);
}

.header-btn.ghost {
  background: transparent;
  color: var(--text-medium);
  border: 1px solid var(--border);
}

.header-btn.ghost:hover {
  background: var(--main-bg);
}

/* ===== منطقة المحتوى ===== */
.content-area {
  flex: 1;
  padding: 1.5rem;
}

/* ===== الصفحات ===== */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* =====================================================
   بطاقات الإحصائيات
   ===================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}

.stat-card.blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.gray .stat-icon { background: #f3f4f6; color: var(--text-light); }
.stat-card.purple .stat-icon { background: var(--purple-light); color: var(--purple); }

/* =====================================================
   بطاقة المحتوى
   ===================================================== */

.content-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.card-body {
  padding: 1.25rem;
}

/* =====================================================
   جدول التذاكر
   ===================================================== */

.tickets-table-wrap {
  overflow-x: auto;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tickets-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  text-align: right;
  font-weight: 700;
  color: var(--text-medium);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tickets-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text-dark);
}

.tickets-table tr:last-child td {
  border-bottom: none;
}

.tickets-table tbody tr {
  transition: var(--transition);
  cursor: pointer;
}

.tickets-table tbody tr:hover {
  background: #f8fafc;
}

.ticket-id-cell {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.ticket-subject-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.no-data-row td {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-light);
  cursor: default;
}

.no-data-row td:hover {
  background: transparent;
}

/* ===== الشارات (Badges) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status-open { background: var(--status-open-bg); color: var(--status-open); }
.badge-status-inprogress { background: var(--status-inprogress-bg); color: var(--status-inprogress); }
.badge-status-pending { background: var(--status-pending-bg); color: var(--status-pending); }
.badge-status-resolved { background: var(--status-resolved-bg); color: var(--status-resolved); }
.badge-status-closed { background: var(--status-closed-bg); color: var(--status-closed); }

.badge-p1 { background: var(--priority-p1-bg); color: var(--priority-p1); }
.badge-p2 { background: var(--priority-p2-bg); color: var(--priority-p2); }
.badge-p3 { background: var(--priority-p3-bg); color: var(--priority-p3); }
.badge-p4 { background: var(--priority-p4-bg); color: var(--priority-p4); }

/* =====================================================
   فلاتر البحث
   ===================================================== */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-input {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: white;
  color: var(--text-dark);
  transition: var(--transition);
  min-width: 120px;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.search-input {
  min-width: 200px;
}

/* =====================================================
   نموذج التذكرة
   ===================================================== */

.ticket-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.ticket-form-grid .full-width {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-medium);
}

.form-group label .required {
  color: var(--danger);
  margin-right: 0.2rem;
}

.form-control {
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: white;
  color: var(--text-dark);
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.form-control.error {
  border-color: var(--danger);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.field-error {
  font-size: 0.8rem;
  color: var(--danger);
  display: none;
}

.field-error.show {
  display: block;
}

.char-counter {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: left;
}

/* ===== كارتات اختيار نوع الطلب ===== */
.ticket-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.25rem;
}

.ticket-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: white;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: inherit;
  color: var(--text-dark);
}

.ticket-type-card:hover {
  border-color: var(--primary);
  background: rgba(37,99,235,0.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.1);
}

.ticket-type-card.selected {
  border-color: var(--primary);
  background: rgba(37,99,235,0.07);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.ticket-type-card .type-icon,
.ticket-type-card .type-label,
.ticket-type-card .type-desc {
  pointer-events: none;
}

.ticket-type-card .type-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.ticket-type-card .type-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.ticket-type-card .type-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.4;
}

/* ===== منطقة رفع الملفات ===== */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #fafafa;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-upload-area .upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.file-upload-area .upload-text {
  font-size: 0.875rem;
  color: var(--text-medium);
}

.file-upload-area .upload-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.file-item .file-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-item .file-name {
  flex: 1;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.file-item .file-size {
  color: var(--text-light);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.file-item .file-remove {
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.file-item .file-remove:hover {
  background: var(--danger-light);
}

/* =====================================================
   تفاصيل التذكرة
   ===================================================== */

.ticket-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

.ticket-detail-main { min-width: 0; }

.ticket-detail-sidebar { min-width: 0; }

.ticket-info-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.ticket-info-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.ticket-info-header h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ticket-info-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.info-row .info-label {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-row .info-value {
  font-size: 0.875rem;
  color: var(--text-dark);
  font-weight: 500;
}

/* ===== خط المحادثة ===== */
.thread-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.thread-item {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
}

.thread-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.thread-avatar.user-avatar-icon { background: var(--primary); }
.thread-avatar.admin-avatar-icon { background: var(--purple); }

.thread-bubble {
  flex: 1;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 0.875rem 1rem;
}

.thread-item.admin-msg .thread-bubble {
  background: var(--purple-light);
  border-color: #ddd6fe;
  border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
}

.thread-bubble-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.thread-author {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
}

.thread-time {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-right: auto;
}

.thread-message {
  font-size: 0.875rem;
  color: var(--text-medium);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-attachments {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-medium);
}

/* ===== نموذج الرد ===== */
.reply-form {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.reply-form h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.reply-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  min-height: 100px;
  resize: vertical;
  transition: var(--transition);
  font-family: inherit;
}

.reply-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

/* =====================================================
   الأزرار
   ===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  color: var(--text-medium);
  border: 1.5px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--main-bg);
  border-color: var(--text-light);
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-block {
  width: 100%;
}

/* ===== زر التحميل ===== */
.btn .btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text { display: none; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =====================================================
   إدارة المستخدمين
   ===================================================== */

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.users-table th,
.users-table td {
  padding: 0.75rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.users-table th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-medium);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.users-table tbody tr:hover {
  background: #f8fafc;
}

.user-status-active {
  color: var(--success);
  font-weight: 600;
}

.user-status-inactive {
  color: var(--text-light);
}

/* =====================================================
   تبديل الحالة (Admin)
   ===================================================== */

.status-select {
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  background: white;
  cursor: pointer;
  transition: var(--transition);
}

.status-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* =====================================================
   النوافذ المنبثقة (Modal)
   ===================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.25s ease;
  overflow: hidden;
}

.modal-box.modal-sm { max-width: 380px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-dark);
  background: var(--main-bg);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ===== رسالة النجاح ===== */
.success-alert {
  text-align: center;
  padding: 0.5rem 0;
}

.success-alert .alert-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.success-alert h3 {
  color: var(--success);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.success-alert p {
  color: var(--text-medium);
  font-size: 0.9rem;
  line-height: 1.5;
}

.success-alert .ticket-id-display {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.3rem 0.875rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* =====================================================
   الرسائل التحذيرية (Toasts)
   ===================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }
.toast.toast-info { background: var(--primary); }

@keyframes toastIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =====================================================
   الصفحة الفارغة
   ===================================================== */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state .empty-icon {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 0.75rem;
}

.empty-state p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* =====================================================
   زر العودة
   ===================================================== */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-medium);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.3rem 0;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.back-btn:hover {
  color: var(--primary);
}

/* =====================================================
   الاستجابة للأجهزة الصغيرة
   ===================================================== */

@media (max-width: 900px) {
  .ticket-detail-layout {
    grid-template-columns: 1fr;
  }

  .ticket-detail-sidebar {
    order: -1;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(100%);
  }

  .sidebar.open {
    transform: translateX(0);
    width: 240px;
  }

  .main-wrapper {
    margin-right: 0;
  }

  #menuToggle {
    display: flex !important;
  }

  .ticket-form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-area {
    padding: 1rem;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-input, .search-input {
    min-width: unset;
    width: 100%;
  }

  /* تحويل الجداول إلى بطاقات على الموبايل */
  .tickets-table thead { display: none; }
  .tickets-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }
  .tickets-table tbody tr td {
    padding: 0;
    border: none;
  }
  .ticket-subject-cell {
    width: 100%;
    max-width: none !important;
    order: -1;
    font-weight: 600;
  }
  .ticket-id-cell { font-size: 0.75rem; }

  .users-table thead { display: none; }
  .users-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }
  .users-table tbody tr td {
    padding: 0;
    border: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .login-card {
    padding: 1.5rem;
  }
}

/* =====================================================
   متنوع
   ===================================================== */

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.text-muted {
  color: var(--text-light);
  font-size: 0.875rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden { display: none !important; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* =====================================================
   Sidebar Overlay (موبايل)
   ===================================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}
.sidebar-overlay.active {
  display: block;
}

/* =====================================================
   Loading / Skeleton
   ===================================================== */
.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 0.75rem;
  color: var(--text-light);
  font-size: 0.9rem;
}
.page-loader .loader-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
.skeleton-text { height: 14px; margin-bottom: 0.5rem; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-stat { height: 40px; width: 60px; margin-bottom: 0.25rem; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================
   إظهار/إخفاء كلمة المرور
   ===================================================== */
.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-left: 2.5rem;
  width: 100%;
}
.password-toggle {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  line-height: 1;
  transition: var(--transition);
}
.password-toggle:hover {
  color: var(--text-medium);
}

/* =====================================================
   مؤشر قوة كلمة المرور
   ===================================================== */
.password-strength {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.4rem;
}
.password-strength .strength-bar {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.password-strength[data-strength="1"] .strength-bar:nth-child(1) { background: var(--danger); }
.password-strength[data-strength="2"] .strength-bar:nth-child(-n+2) { background: #f97316; }
.password-strength[data-strength="3"] .strength-bar:nth-child(-n+3) { background: var(--warning); }
.password-strength[data-strength="4"] .strength-bar { background: var(--success); }
.password-strength-label {
  font-size: 0.75rem;
  margin-top: 0.15rem;
  font-weight: 600;
}
.password-strength-label.weak { color: var(--danger); }
.password-strength-label.fair { color: #f97316; }
.password-strength-label.good { color: var(--warning); }
.password-strength-label.strong { color: var(--success); }

/* =====================================================
   Breadcrumb
   ===================================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.breadcrumb .breadcrumb-sep {
  opacity: 0.5;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem;
}
.pagination button {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--text-medium);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.pagination button:hover:not(:disabled):not(.active) {
  background: var(--main-bg);
  border-color: var(--text-light);
}
.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .page-info {
  font-size: 0.8rem;
  color: var(--text-light);
  margin: 0 0.5rem;
}

/* =====================================================
   Toast تحسينات
   ===================================================== */
.toast .toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  margin-right: auto;
  line-height: 1;
}
.toast .toast-close:hover { color: white; }

/* =====================================================
   Confirm Dialog
   ===================================================== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}
.confirm-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 360px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
  animation: slideUp 0.2s ease;
}
.confirm-box .confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}
.confirm-box h4 {
  font-size: 1rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}
.confirm-box p {
  font-size: 0.875rem;
  color: var(--text-medium);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* =====================================================
   عداد الأحرف تحذير
   ===================================================== */
.char-counter.warning { color: var(--warning); font-weight: 600; }
.char-counter.danger { color: var(--danger); font-weight: 700; }

/* =====================================================
   Progress Bar لرفع الملفات
   ===================================================== */
.upload-progress {
  margin-top: 0.5rem;
}
.upload-progress .progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}
.upload-progress .progress-text {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.2rem;
  text-align: center;
}

/* =====================================================
   زر إغلاق التذكرة للمستخدم
   ===================================================== */
.close-ticket-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.6rem;
  background: var(--success-light);
  color: var(--success);
  border: 1.5px solid var(--success);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.close-ticket-btn:hover {
  background: var(--success);
  color: white;
}

/* =====================================================
   Reply attachment
   ===================================================== */
.reply-attach-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.reply-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-light);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}
.reply-attach-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.reply-file-name {
  font-size: 0.8rem;
  color: var(--text-medium);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.reply-file-name .remove-reply-file {
  color: var(--danger);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.85rem;
}

/* =====================================================
   Image thumbnail preview
   ===================================================== */
.file-item .file-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

/* =====================================================
   Sortable columns
   ===================================================== */
.tickets-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.tickets-table th.sortable:hover {
  color: var(--primary);
}
.tickets-table th.sortable .sort-icon {
  font-size: 0.65rem;
  opacity: 0.4;
  margin-right: 0.2rem;
}
.tickets-table th.sortable.sort-asc .sort-icon,
.tickets-table th.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
}

/* =====================================================
   Charts placeholder
   ===================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.chart-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--card-border);
  padding: 1.25rem;
}
.chart-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1rem;
}
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chart-bar-label {
  font-size: 0.78rem;
  color: var(--text-medium);
  min-width: 80px;
  text-align: left;
}
.chart-bar-track {
  flex: 1;
  height: 22px;
  background: var(--main-bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  min-width: 24px;
}
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   ثيمات حسب نوع المستخدم (Role-based Themes)
   ===================================================== */

/* بوابة الدعم الفني - ثيم بيج زيتي */
body[data-page="support"] {
  --sidebar-bg: #3a3520;
  --sidebar-hover: #4f4829;
  --sidebar-active: var(--support-color);
  --sidebar-border: #4f4829;
  --sidebar-text: #c9b99a;
  --primary: var(--support-color);
  --primary-hover: #705e2a;
  --primary-light: #faf7ec;
  --accent: var(--support-color);
}

body[data-page="support"] .sidebar-header {
  border-bottom-color: #4f4829;
}

body[data-page="support"] .user-avatar {
  background: var(--support-color) !important;
}

body[data-page="support"] .btn-primary,
body[data-page="support"] .login-btn {
  background: var(--support-color);
}
body[data-page="support"] .btn-primary:hover,
body[data-page="support"] .login-btn:hover {
  background: #705e2a;
}

/* لوحة الإدارة - ثيم زيتي غامق */
body[data-page="admin"] {
  --sidebar-bg: #1c3620;
  --sidebar-hover: #2a4f2e;
  --sidebar-active: var(--admin-color);
  --sidebar-border: #2a4f2e;
  --sidebar-text: #9ec49f;
  --primary: var(--admin-color);
  --primary-hover: #2d5a2e;
  --primary-light: #f0f7f0;
  --accent: var(--admin-color);
}

body[data-page="admin"] .sidebar-header {
  border-bottom-color: #2a4f2e;
}

body[data-page="admin"] .user-avatar {
  background: var(--admin-color) !important;
}

/* ===== أنماط رسائل الدعم الفني ===== */
.thread-avatar.support-avatar-icon { background: var(--success); }

.thread-item.support-msg .thread-bubble {
  background: var(--success-light);
  border-color: #a7f3d0;
  border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
}

/* ===== شارات الأدوار ===== */
.badge-role-admin { background: var(--purple-light); color: var(--purple); font-weight: 600; }
.badge-role-support { background: var(--success-light); color: #047857; font-weight: 600; }
.badge-role-user { background: #f3f4f6; color: #6b7280; font-weight: 600; }

/* =====================================================
   تحسينات بصرية وحركات (Visual Polish & Animations)
   ===================================================== */

/* حركة ظهور الصفحات */
.page {
  animation: pageIn 0.3s ease;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* حركة عناصر الشريط الجانبي */
.nav-item {
  transition: all 0.2s ease;
  position: relative;
}

.nav-item:hover {
  transform: translateX(-3px);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--sidebar-active);
  border-radius: 3px 0 0 3px;
}

/* حركة البطاقات */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

/* حركة صفوف الجدول */
.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--primary-light);
}

/* حركة الأزرار */
.btn {
  transition: all 0.2s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* حركة Toast محسنة */
.toast {
  animation: toastSlideIn 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* خلفية صفحة الدخول متحركة */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* تحسين بطاقة الدخول */
.login-card {
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}

/* حركة الشعار */
.login-logo .logo-icon {
  transition: transform 0.3s ease;
}

.login-logo .logo-icon:hover {
  transform: scale(1.08) rotate(-3deg);
}

/* ===== حالة تحميل الهيكل (Skeleton) ===== */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* =====================================================
   تحديثات التصميم الحديث v3.0
   ===================================================== */

.sidebar-logo-img { height: 44px; width: auto; max-width: 160px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4)); }
.sidebar-logo { flex-direction: column; align-items: flex-start; gap: 0.4rem; }

.user-avatar.admin-avatar   { background: var(--admin-color) !important;   box-shadow: 0 2px 8px rgba(61,107,62,0.4); }
.user-avatar.support-avatar { background: var(--support-color) !important; box-shadow: 0 2px 8px rgba(139,122,62,0.4); }

.badge-role-admin   { background: rgba(61,107,62,0.12);  color: #2d5a2e; border: 1px solid rgba(61,107,62,0.3); }
.badge-role-support { background: rgba(139,122,62,0.12); color: #5d4d10; border: 1px solid rgba(139,122,62,0.3); }
.badge-role-user    { background: var(--primary-light);  color: var(--primary); border: 1px solid rgba(37,99,235,0.2); }

.portal-header { background: linear-gradient(to left, #ffffff, #f8faff); border-bottom: 2px solid #eef2ff; box-shadow: 0 2px 12px rgba(37,99,235,0.06); }
.header-title { font-size: 1.1rem; font-weight: 800; }

.stat-card { border-radius: 14px; border: none; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden; position: relative; }
.stat-card::before { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 3px; border-radius: 14px 14px 0 0; }
.stat-card.blue::before   { background: var(--primary); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.green::before  { background: var(--success); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.gray::before   { background: #94a3b8; }
.stat-card.purple::before { background: var(--purple); }
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,0.1); }
.stat-card .stat-value { font-size: 2rem; font-weight: 900; }

.content-card { border-radius: 14px; border: none; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.card-header { background: linear-gradient(to left, #fafbff, #ffffff); border-bottom: 1.5px solid #eef2ff; padding: 1.1rem 1.5rem; }
.card-header h3 { font-size: 1.05rem; font-weight: 800; }

.tickets-table thead th { background: linear-gradient(to bottom, #f0f4ff, #eef2ff); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.9rem 1rem; }
.tickets-table tbody tr:hover { background: #f0f7ff; }

.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%); box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%); box-shadow: 0 4px 16px rgba(37,99,235,0.4); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, var(--success) 0%, #059669 100%); box-shadow: 0 2px 8px rgba(16,185,129,0.3); }
.btn-success:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(16,185,129,0.4); transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%); box-shadow: 0 2px 8px rgba(239,68,68,0.3); }
.btn-danger:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(239,68,68,0.4); transform: translateY(-1px); }
.btn-outline:hover:not(:disabled) { background: #f0f4ff; border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }

.login-card { border: none; box-shadow: 0 24px 80px rgba(0,0,0,0.25); border-radius: 20px; padding: 3rem 2.5rem; }
.login-logo-img { max-height: 80px; width: auto; max-width: 220px; object-fit: contain; display: block; margin: 0 auto 1.25rem; }
.login-title { font-size: 1.45rem; font-weight: 800; text-align: center; margin-bottom: 0.25rem; }
.login-subtitle { text-align: center; font-size: 0.875rem; color: var(--text-light); }
.login-btn { padding: 0.9rem; font-size: 1.05rem; font-weight: 800; }

.ticket-log-section { background: #f8fafc; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; margin-top: 0.75rem; }
.ticket-log-header { padding: 0.7rem 1rem; background: linear-gradient(to left, #f0f4ff, #eef2ff); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.ticket-log-header h4 { font-size: 0.82rem; font-weight: 800; color: var(--text-dark); margin: 0; }
.ticket-log-list { max-height: 200px; overflow-y: auto; padding: 0.4rem 0; }
.ticket-log-item { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.45rem 1rem; border-bottom: 1px solid rgba(0,0,0,0.04); }
.ticket-log-item:last-child { border-bottom: none; }
.ticket-log-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 4px; }
.ticket-log-dot.admin   { background: var(--admin-color); }
.ticket-log-dot.support { background: var(--support-color); }
.ticket-log-dot.user    { background: var(--primary); }
.ticket-log-content { flex: 1; min-width: 0; }
.ticket-log-action { font-size: 0.78rem; font-weight: 700; color: var(--text-dark); line-height: 1.3; }
.ticket-log-meta { font-size: 0.7rem; color: var(--text-light); margin-top: 1px; }
.ticket-log-empty { padding: 1.25rem; text-align: center; color: var(--text-light); font-size: 0.8rem; }

.assign-section { background: #f8faff; border: 1.5px solid #dde8ff; border-radius: 8px; padding: 0.75rem; margin-bottom: 0.75rem; }
.assign-section label { font-size: 0.76rem; font-weight: 800; color: var(--text-medium); display: block; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; }
.assign-select { width: 100%; padding: 0.5rem 0.75rem; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.82rem; font-family: inherit; background: white; margin-bottom: 0.5rem; cursor: pointer; }
.assign-select:focus { outline: none; border-color: var(--admin-color); box-shadow: 0 0 0 3px rgba(61,107,62,0.12); }

.auto-priority-box { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; border-radius: 10px; border: 1.5px solid var(--border); background: linear-gradient(to left, #f8faff, #fafbff); }
.auto-priority-badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.875rem; border-radius: 20px; font-size: 0.78rem; font-weight: 800; flex-shrink: 0; }
.auto-priority-text { font-size: 0.78rem; color: var(--text-medium); line-height: 1.4; }

.form-helper-note { font-size: 0.76rem; color: var(--text-medium); margin-top: 0.5rem; padding: 0.45rem 0.75rem; background: #f0f9ff; border-right: 3px solid var(--accent); border-radius: 0 6px 6px 0; font-style: italic; }

.ticket-info-card { border-radius: 12px; border: none; box-shadow: 0 2px 10px rgba(0,0,0,0.07); overflow: hidden; }
.ticket-info-header { background: linear-gradient(to left, #f0f4ff, #eef2ff); padding: 0.8rem 1.1rem; border-bottom: 1.5px solid #e0e8ff; }
.ticket-info-header h4 { font-size: 0.875rem; font-weight: 800; color: var(--text-dark); }
.info-row { padding: 0.7rem 1.1rem; border-bottom: 1px solid #f3f4f6; display: flex; flex-direction: column; gap: 0.2rem; }
.info-label { font-size: 0.8rem; font-weight: 800; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.info-value { font-size: 0.85rem; color: var(--text-dark); font-weight: 700; }

.ticket-assigned-tag { display: inline-flex; align-items: center; gap: 0.4rem; background: rgba(61,107,62,0.1); color: var(--admin-color); padding: 0.25rem 0.6rem; border-radius: 20px; font-size: 0.76rem; font-weight: 700; }

.header-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--text-light); font-weight: 600; }
.header-brand img { height: 26px; width: auto; object-fit: contain; }
