/* ═══════════════════════════════════════
   FXNavigator Admin Panel — Styles v2
   ═══════════════════════════════════════ */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2332;
  --bg-hover: #243044;
  --bg-input: #0d1520;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #00c853;
  --accent-hover: #00e676;
  --accent-dim: rgba(0, 200, 83, 0.12);

  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  --border: #1e293b;
  --radius: 10px;
  --radius-sm: 6px;

  --sidebar-w: 250px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

body.en { direction: ltr; }
body.en .login-card,
body.en .page-header,
body.en .stat-card { text-align: left; }
body.en .nav-item { justify-content: flex-start; }
body.en table th { text-align: left; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.screen { display: flex; }
.screen.hidden { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: all .2s; font-family: var(--font);
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-dim); }
.btn-full { width: 100%; justify-content: center; }
.btn-text { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: .8rem; }
.btn-text:hover { color: var(--danger); }
.btn-close { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.btn-close:hover { background: var(--bg-hover); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Login */
#login-screen {
  height: 100vh; width: 100vw;
  align-items: center; justify-content: center;
  background: var(--bg-primary);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(0,200,83,.08) 0%, transparent 60%);
}
.login-card {
  background: var(--bg-card); padding: 40px; border-radius: var(--radius);
  width: 400px; max-width: 90vw; border: 1px solid var(--border);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-wrap {
  width: 64px; height: 64px; margin: 0 auto 12px;
  background: var(--accent-dim); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo h1 { font-size: 1.5rem; color: var(--text-primary); }
.login-logo p { color: var(--text-muted); font-size: .85rem; margin-top: 2px; }

/* Form fields */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .8rem; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text-primary); font-size: .9rem; font-family: var(--font);
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.field textarea { resize: vertical; min-height: 72px; }
.field select { cursor: pointer; }
.field input:disabled { opacity: .5; cursor: not-allowed; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.search-field { max-width: 320px; }
.hidden { display: none !important; }

.error-msg { color: var(--danger); font-size: .8rem; text-align: center; margin-top: 8px; min-height: 20px; }
.loading-spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w); height: 100vh; background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; right: 0; top: 0; z-index: 100;
}
body.en #sidebar { right: auto; left: 0; border-left: none; border-right: 1px solid var(--border); }
body.en #main-content { margin-right: 0; margin-left: var(--sidebar-w); }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 1.1rem;
}
.sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-size: .9rem; cursor: pointer; transition: all .2s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item .icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.lang-toggle {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-primary); border-radius: var(--radius-sm);
}
.lang-btn {
  flex: 1; padding: 4px 8px; border: none; border-radius: 4px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: .75rem; font-family: var(--font); transition: all .2s;
}
.lang-btn.active { background: var(--accent); color: #000; font-weight: 600; }
.lang-btn:hover:not(.active) { color: var(--text-primary); }
.user-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; }
.user-chip span { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Main */
#main-content {
  margin-right: var(--sidebar-w); flex: 1;
  height: 100vh; overflow-y: auto; padding: 24px 32px;
}
.page { display: none; }
.page.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
}
.page-header-text h2 { font-size: 1.4rem; font-weight: 700; }
.page-header-text p { color: var(--text-muted); font-size: .85rem; margin-top: 2px; }

/* Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-secondary); }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-header-row h3 { margin-bottom: 0; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center;
  transition: all .2s;
}
.stat-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: right; padding: 10px 12px; font-size: .8rem;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  font-weight: 600; white-space: nowrap;
}
body.en thead th { text-align: left; }
tbody td {
  padding: 10px 12px; font-size: .85rem; border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--accent-dim); color: var(--accent); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.12); color: var(--info); }

.list-placeholder { color: var(--text-muted); font-size: .85rem; padding: 12px 0; text-align: center; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); width: 540px; max-width: 92vw;
  max-height: 85vh; overflow-y: auto; animation: modalIn .25s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; color: var(--text-primary); font-size: 1.05rem; }
#modal-body { padding: 20px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: .9rem; z-index: 2000; animation: toastIn .3s ease;
  direction: rtl; box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
  #sidebar {
    width: 60px;
    transform: translateX(100%);
    transition: transform .3s ease;
  }
  body.en #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  .sidebar-brand span, .nav-item span:not(.icon), .user-chip span { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-footer { padding: 8px; }
  .user-chip { justify-content: center; }
  .user-chip button { display: none; }
  .lang-toggle { flex-direction: column; }
  #main-content { margin-right: 0 !important; padding: 16px; }
  body.en #main-content { margin-left: 0 !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row { flex-direction: column; gap: 0; }
  .page-header { flex-direction: column; align-items: stretch; }

  .mobile-menu-btn {
    display: flex !important;
    position: fixed; top: 12px; right: 12px; z-index: 101;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px;
    color: var(--text-primary); cursor: pointer;
  }
  body.en .mobile-menu-btn { right: auto; left: 12px; }
}
.mobile-menu-btn { display: none; }
