/**
 * نظام إدارة الحاويات والعقود
 * ملف التنسيقات الموحد
 * style.css
 */

/* ===== المتغيرات الأساسية ===== */
:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --secondary-color: #3b82f6;
  --secondary-hover: #2563eb;
  --success-color: #10b981;
  --success-hover: #059669;
  --warning-color: #f59e0b;
  --warning-hover: #d97706;
  --danger-color: #ef4444;
  --purple-color: #8b5cf6;
  --dark-color: #0f172a;
  --light-bg: #f8fafc;
  --card-bg: #ffffff;
  --sidebar-bg: #1a202c;
  --sidebar-hover: #2d3748;
  --border-color: #e2e8f0;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 64px;
  --transition: 0.3s ease;
}

/* ===== Reset ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Cairo", Arial, sans-serif;
  background: var(--light-bg);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== App Layout ===== */
.app-wrapper { display: flex; min-height: 100vh; }

.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-right var(--transition);
  display: flex;
  flex-direction: column;
}

.main-content.sidebar-collapsed {
  margin-right: var(--sidebar-collapsed-width);
}

.page-content {
  flex: 1;
  padding: 24px;
  margin-top: var(--topbar-height);
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: white;
  z-index: 200;
  transition: width var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--topbar-height);
  background: rgba(0,0,0,0.2);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-color), #e76968);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(217, 73, 72, 0.3);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.sidebar-brand-name { font-size: 17px; font-weight: 700; }
.sidebar-brand-desc { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.sidebar.collapsed .sidebar-brand { opacity: 0; width: 0; }

.sidebar-toggle {
  position: absolute;
  top: 22px;
  left: -14px;
  width: 28px;
  height: 28px;
  background: var(--primary-color);
  border: 3px solid var(--sidebar-bg);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition);
  z-index: 10;
}

.sidebar-toggle:hover { background: var(--primary-hover); transform: scale(1.1); }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.nav-section { margin-bottom: 24px; }

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-light);
  padding: 0 14px;
  margin-bottom: 10px;
}

.sidebar.collapsed .nav-section-title { font-size: 0; text-align: center; }
.sidebar.collapsed .nav-section-title::after { content: '•••'; font-size: 12px; }

.nav-item { margin-bottom: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover { background: var(--sidebar-hover); color: white; }

.nav-link.active {
  background: linear-gradient(135deg, var(--primary-color), #e76968);
  color: white;
  box-shadow: 0 4px 12px rgba(217, 73, 72, 0.3);
}

.nav-link-icon { font-size: 20px; width: 26px; text-align: center; flex-shrink: 0; }
.nav-link-text { flex: 1; font-size: 14px; font-weight: 500; }

.nav-link-badge {
  background: var(--danger-color);
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar.collapsed .nav-link { justify-content: center; padding: 14px; }
.sidebar.collapsed .nav-link-text, .sidebar.collapsed .nav-link-badge { display: none; }

.sidebar.collapsed .nav-link { position: relative; }

.sidebar.collapsed .nav-link::after {
  content: attr(data-title);
  position: absolute;
  right: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--sidebar-hover);
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

.sidebar.collapsed .nav-link:hover::after { opacity: 1; visibility: visible; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
}

.sidebar-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #e76968);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 12px; color: var(--text-light); }

.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 10px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0;
  right: var(--sidebar-width);
  left: 0;
  height: var(--topbar-height);
  background: linear-gradient(135deg, var(--primary-color) 0%, #e76968 100%);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  z-index: 100;
  transition: right var(--transition);
}

.topbar.sidebar-collapsed { right: var(--sidebar-collapsed-width); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title .page-icon { font-size: 28px; }
.topbar-title h1 { font-size: 20px; font-weight: 700; margin: 0; }

.topbar-left { display: flex; align-items: center; gap: 12px; }

.user-dropdown { position: relative; }

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.user-btn:hover { background: rgba(255,255,255,0.25); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-name { font-weight: 600; font-size: 14px; }

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 1000;
  overflow: hidden;
}

.user-dropdown.active .user-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-header {
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-bottom: 1px solid var(--border-color);
}

.dropdown-header-name { font-weight: 700; color: var(--dark-color); }
.dropdown-header-role { font-size: 12px; color: var(--text-muted); }

.user-dropdown-menu a, .user-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-color);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.user-dropdown-menu a:hover, .user-dropdown-menu button:hover {
  background: var(--light-bg);
  color: var(--primary-color);
}

.dropdown-divider { height: 1px; background: var(--border-color); margin: 4px 0; }
.logout-btn { color: var(--danger-color) !important; }

/* ===== Footer ===== */
.footer {
  background: white;
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-copyright { display: flex; align-items: center; gap: 8px; }
.footer-copyright strong { color: var(--primary-color); }
.footer-status { display: flex; align-items: center; gap: 6px; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
  animation: pulse 2s infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ===== Buttons ===== */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary-color); color: white; }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-hover); }
.btn-success { background: var(--success-color); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }
.btn-warning { background: var(--warning-color); color: white; }
.btn-warning:hover:not(:disabled) { background: var(--warning-hover); }
.btn-danger { background: var(--danger-color); color: white; }
.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp:hover:not(:disabled) { background: #128C7E; }
.btn-call { background: var(--secondary-color); color: white; }
.btn-ghost { background: transparent; color: var(--text-color); border: 2px solid var(--border-color); }
.btn-ghost:hover:not(:disabled) { background: var(--light-bg); border-color: var(--text-color); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--dark-color);
  font-size: 14px;
}

.form-label.required::after { content: " *"; color: var(--danger-color); }

input:not([type="checkbox"]):not([type="file"]),
select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  background: white;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

input.error, select.error { border-color: var(--danger-color); background: #fff5f5; }

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary-color);
}

.card-title { font-size: 20px; font-weight: 700; color: var(--primary-color); display: flex; align-items: center; gap: 10px; }

/* ===== Stats Cards ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.stat-icon.primary { background: var(--primary-light); }
.stat-icon.warning { background: #fff3cd; }
.stat-icon.info { background: #d1ecf1; }
.stat-icon.success { background: #d4edda; }

.stat-info { flex: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--dark-color); }

/* ===== Table ===== */
.table-container {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td { border-bottom: 1px solid var(--border-color); padding: 14px 16px; text-align: right; vertical-align: middle; }

th {
  background: linear-gradient(135deg, var(--primary-color) 0%, #e76968 100%);
  color: white;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

tbody tr { transition: var(--transition); }
tbody tr:nth-child(even) { background: #f8f9fa; }
tbody tr:hover { background: var(--primary-light); }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-danger { background: #f8d7da; color: #721c24; }

/* ===== Pagination ===== */
.pagination {
  padding: 20px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: white;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) { border-color: var(--primary-color); color: var(--primary-color); }
.page-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + 16px);
  left: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-right: 4px solid var(--success-color); }
.toast.error { border-right: 4px solid var(--danger-color); }
.toast.warning { border-right: 4px solid var(--warning-color); }
.toast.info { border-right: 4px solid var(--secondary-color); }

/* ===== Login Modal ===== */
.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-modal.active { display: flex; }

.login-card {
  background: white;
  width: 100%;
  max-width: 420px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), #e76968);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(217, 73, 72, 0.3);
}

.login-title { font-size: 24px; font-weight: 700; color: var(--dark-color); }

.login-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: none;
  font-size: 14px;
}

.login-error.show { display: block; }

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--success-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-login:hover { background: var(--success-hover); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-small { font-size: 13px; color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

/* ===== Dark Mode ===== */
[data-theme="dark"] {
  --light-bg: #0f1419;
  --card-bg: #1a2332;
  --sidebar-bg: #0d1117;
  --sidebar-hover: #1a2332;
  --border-color: rgba(255,255,255,0.08);
  --text-color: #e1e4e8;
  --text-muted: #8b949e;
  --text-light: #6e7681;
  --dark-color: #f0f6fc;
  --primary-light: rgba(217,73,72,0.12);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] body { background: var(--light-bg); color: var(--text-color); }
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .table-container { background: var(--card-bg); border: 1px solid var(--border-color); }
[data-theme="dark"] .stat-value { color: var(--text-color); }

[data-theme="dark"] input:not([type="checkbox"]):not([type="file"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #161b22;
  color: var(--text-color);
  border-color: var(--border-color);
}

[data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}

[data-theme="dark"] .form-label { color: var(--text-color); }

[data-theme="dark"] th {
  background: linear-gradient(135deg, #1a2332 0%, #243447 100%);
  color: var(--text-color);
}

[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
[data-theme="dark"] tbody tr:hover { background: rgba(217,73,72,0.08); }

[data-theme="dark"] .toast { background: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color); }
[data-theme="dark"] .login-card { background: var(--card-bg); }
[data-theme="dark"] .login-title { color: var(--text-color); }
[data-theme="dark"] .footer { background: var(--card-bg); border-color: var(--border-color); }

[data-theme="dark"] .user-dropdown-menu { background: var(--card-bg); border: 1px solid var(--border-color); }
[data-theme="dark"] .user-dropdown-menu a, [data-theme="dark"] .user-dropdown-menu button { color: var(--text-color); }
[data-theme="dark"] .user-dropdown-menu a:hover, [data-theme="dark"] .user-dropdown-menu button:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .dropdown-header { background: rgba(255,255,255,0.03); border-color: var(--border-color); }
[data-theme="dark"] .dropdown-header-name { color: var(--text-color); }

[data-theme="dark"] .btn-ghost { border-color: var(--border-color); color: var(--text-color); }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.05); }

[data-theme="dark"] .page-btn { background: var(--card-bg); color: var(--text-color); border-color: var(--border-color); }

[data-theme="dark"] .badge-success { background: rgba(46,204,113,0.15); color: #2ecc71; }
[data-theme="dark"] .badge-warning { background: rgba(230,126,34,0.15); color: #e67e22; }
[data-theme="dark"] .badge-info { background: rgba(52,152,219,0.15); color: #3498db; }
[data-theme="dark"] .badge-danger { background: rgba(231,76,60,0.15); color: #e74c3c; }

[data-theme="dark"] .stat-icon.primary { background: rgba(217,73,72,0.15); }
[data-theme="dark"] .stat-icon.warning { background: rgba(230,126,34,0.15); }
[data-theme="dark"] .stat-icon.info { background: rgba(52,152,219,0.15); }
[data-theme="dark"] .stat-icon.success { background: rgba(46,204,113,0.15); }

[data-theme="dark"] input.error, [data-theme="dark"] select.error { border-color: var(--danger-color); background: rgba(231,76,60,0.1); }
[data-theme="dark"] .login-error { background: rgba(220,38,38,0.1); }

/* ===== Theme Toggle Button ===== */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }

/* ===== Language Toggle Button ===== */
.lang-toggle-btn {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}
.lang-toggle-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .topbar { right: 0; }
  .mobile-menu-btn { display: flex; }
  .sidebar-overlay { display: block; }
}

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .card { padding: 16px; }
  .topbar-title h1 { font-size: 16px; }
  .user-name { display: none; }
  .footer { flex-direction: column; text-align: center; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ===== Print ===== */
@media print {
  .sidebar, .topbar, .footer, .toast-container, .login-modal { display: none !important; }
  .main-content { margin: 0 !important; }
  .page-content { margin-top: 0 !important; padding: 0 !important; }
}
/* Source Switch Toggle */
.source-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-hover, #e2e8f0);
  padding: 4px;
  border-radius: 99px;
  gap: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}
.source-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #475569);
  margin-right: 8px;
  margin-left: 4px;
}
.source-pill {
  position: relative;
  cursor: pointer;
  margin: 0;
}
.source-pill input {
  display: none;
}
.source-pill span {
  display: block;
  padding: 6px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-color, #334155);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.source-pill input:checked + span {
  background: var(--primary-color, #2563eb);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25), 0 0 0 1px rgba(37, 99, 235, 0.1);
}

/* Source Switch styling for Dark Headers (Contracts Pending) */
.search-section-header .source-switch {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}
.search-section-header .source-label {
  color: #f8fafc;
}
.search-section-header .source-pill span {
  color: #e2e8f0;
}
.search-section-header .source-pill.active span,
.search-section-header .source-pill input:checked + span {
  background: #ffffff;
  color: var(--primary-color, #2563eb);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
