/* ICB Admin Portal — Dark Theme, Bilingual (AR/EN) */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

/* ── Login Screen ── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-box {
  background: #1e293b;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-box h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: .25rem;
}

.login-box .subtitle {
  color: #64748b;
  font-size: .85rem;
  margin-bottom: 2rem;
}

.login-box input {
  width: 100%;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .9rem;
  margin-bottom: .75rem;
  direction: ltr;
  text-align: left;
}

.login-box input:focus {
  outline: none;
  border-color: #38bdf8;
}

.login-box .login-actions {
  display: flex;
  gap: 8px;
  margin-top: .5rem;
}

.login-box .login-actions button {
  flex: 1;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.login-box .login-actions button:hover { background: #1d4ed8; }

.btn-lang-login {
  flex: 0 0 auto !important;
  background: #334155 !important;
  color: #94a3b8 !important;
  font-size: .8rem !important;
  padding: 10px 14px !important;
  min-width: 42px;
}

.btn-lang-login:hover {
  background: #475569 !important;
  color: #e2e8f0 !important;
}

.login-error {
  color: #f87171;
  font-size: .8rem;
  margin-top: .75rem;
  min-height: 1.2em;
}

/* ── Header ── */
.header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header .logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #38bdf8;
}

.header .logo span {
  color: #64748b;
  font-weight: 400;
  font-size: .85rem;
  margin-inline-start: 8px;
}

.user-info {
  color: #94a3b8;
  font-size: .8rem;
}

.user-info strong {
  color: #e2e8f0;
  font-weight: 600;
}

.btn-lang {
  background: #334155;
  border: 1px solid #475569;
  color: #94a3b8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .03em;
}

.btn-lang:hover {
  background: #475569;
  color: #e2e8f0;
}

.btn-logout {
  background: none;
  border: 1px solid #475569;
  color: #94a3b8;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
}

.btn-logout:hover {
  border-color: #f87171;
  color: #f87171;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.stat-card {
  background: #1e293b;
  border-radius: 10px;
  padding: 12px 20px;
  flex: 1;
  min-width: 120px;
  text-align: center;
}

.stat-card .count {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card .label {
  color: #94a3b8;
  font-size: .75rem;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid #334155;
}

.tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: .9rem;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  font-family: inherit;
}

.tab-btn:hover { color: #e2e8f0; }

.tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

/* ── Tab Content ── */
.tab-content {
  display: none;
  padding: 20px 24px;
}

.tab-content.active { display: block; }

/* ── Toolbar (search + add) ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input[type="text"] {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: .85rem;
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}

.toolbar input[type="text"]:focus {
  outline: none;
  border-color: #38bdf8;
}

.toolbar select {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: .85rem;
  cursor: pointer;
}

.toolbar select:focus {
  outline: none;
  border-color: #38bdf8;
}

.btn-add {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.btn-add:hover { background: #15803d; }

.btn-tpl {
  background: none;
  border: 1px solid #475569;
  color: #94a3b8;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn-tpl:hover { border-color: #38bdf8; color: #38bdf8; }

.btn-upload {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.btn-upload:hover { background: #1d4ed8; }

.toolbar-spacer { flex: 1; }

/* ── Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.data-table th {
  background: #1e293b;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .75rem;
  font-weight: 600;
  padding: 10px 12px;
  text-align: start;
  border-bottom: 1px solid #334155;
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #1e293b;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #1e293b44;
}

.data-table .empty-row td {
  text-align: center;
  color: #64748b;
  padding: 2rem;
}

/* ── Status Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-active { background: #166534; color: #4ade80; }
.badge-inactive { background: #7f1d1d; color: #fca5a5; }
.badge-suspended { background: #78350f; color: #fbbf24; }
.badge-role { background: #334155; color: #94a3b8; }

/* ── Action Buttons (in table) ── */
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-action {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: .75rem;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn-action:hover { background: #475569; }
.btn-action.danger { border-color: #dc2626; color: #fca5a5; }
.btn-action.danger:hover { background: #dc2626; color: #fff; }
.btn-action.success { border-color: #16a34a; color: #4ade80; }
.btn-action.success:hover { background: #16a34a; color: #fff; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: #1e293b;
  border-radius: 14px;
  padding: 0;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,.4);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
}

.modal-header h2 { font-size: 1rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: #f87171; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #334155;
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

/* ── Form Fields ── */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  color: #94a3b8;
  font-size: .8rem;
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .85rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #38bdf8;
}

.form-group input[dir="ltr"],
.form-group select[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.form-group .hint {
  color: #64748b;
  font-size: .7rem;
  margin-top: 2px;
}

/* ── Buttons (modal) ── */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.btn-cancel {
  background: none;
  border: 1px solid #475569;
  color: #94a3b8;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
}

.btn-cancel:hover { border-color: #94a3b8; color: #e2e8f0; }

/* ── Bulk upload summary ── */
.bulk-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bulk-stat {
  background: #0f172a;
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  flex: 1;
  min-width: 80px;
}

.bulk-stat .num {
  font-size: 1.5rem;
  font-weight: 700;
}

.bulk-stat .num.green { color: #4ade80; }
.bulk-stat .num.yellow { color: #fbbf24; }
.bulk-stat .num.red { color: #fca5a5; }

.bulk-stat .lbl {
  font-size: .7rem;
  color: #94a3b8;
  margin-top: 2px;
}

.bulk-list {
  max-height: 200px;
  overflow-y: auto;
  font-size: .8rem;
  margin-bottom: 12px;
}

.bulk-list table {
  width: 100%;
  border-collapse: collapse;
}

.bulk-list th,
.bulk-list td {
  padding: 4px 8px;
  text-align: start;
  border-bottom: 1px solid #334155;
}

.bulk-list th {
  color: #64748b;
  font-size: .7rem;
  text-transform: uppercase;
}

.bulk-list tr.dup td {
  color: #64748b;
  text-decoration: line-through;
}

.bulk-progress {
  background: #334155;
  border-radius: 6px;
  height: 6px;
  margin: 12px 0;
  overflow: hidden;
}

.bulk-progress-bar {
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  height: 100%;
  width: 0%;
  transition: width .3s;
}

/* ── Upload Panel (User bulk) ── */
.upload-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.upload-panel-header .upload-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.upload-panel-header .upload-title {
  font-size: .95rem;
  font-weight: 600;
}

.upload-panel-header .upload-desc {
  font-size: .75rem;
  color: #64748b;
  margin-top: 2px;
}

.upload-org-bar {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-org-bar .org-label {
  color: #94a3b8;
  font-size: .8rem;
  white-space: nowrap;
}

.upload-org-bar select {
  flex: 1;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .85rem;
}

.upload-org-bar select:focus {
  outline: none;
  border-color: #38bdf8;
}

.upload-org-bar .org-locked {
  flex: 1;
  color: #38bdf8;
  font-weight: 600;
  font-size: .85rem;
}

.upload-pw-bar {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-pw-bar .pw-label {
  color: #94a3b8;
  font-size: .8rem;
  white-space: nowrap;
}

.upload-pw-bar input {
  flex: 1;
  max-width: 200px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .85rem;
  direction: ltr;
  text-align: left;
}

.upload-pw-bar input:focus {
  outline: none;
  border-color: #38bdf8;
}

.upload-pw-bar .pw-hint {
  color: #64748b;
  font-size: .7rem;
}

.upload-dropzone {
  border: 2px dashed #334155;
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 14px;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, .05);
}

.upload-dropzone .drop-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.upload-dropzone .drop-text {
  color: #94a3b8;
  font-size: .85rem;
}

.upload-dropzone .drop-text strong {
  color: #38bdf8;
  cursor: pointer;
}

.upload-dropzone .drop-hint {
  color: #64748b;
  font-size: .7rem;
  margin-top: 6px;
}

.upload-dropzone.has-file {
  border-color: #16a34a;
  background: rgba(22, 163, 74, .05);
}

.upload-dropzone.has-file .drop-icon { color: #4ade80; }

.upload-tpl-link {
  text-align: center;
  margin-bottom: 6px;
}

.upload-tpl-link a {
  color: #38bdf8;
  font-size: .8rem;
  text-decoration: none;
  cursor: pointer;
}

.upload-tpl-link a:hover { text-decoration: underline; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: .85rem;
  z-index: 2000;
  transition: transform .3s ease;
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: #16a34a; color: #4ade80; }
.toast.error { border-color: #dc2626; color: #fca5a5; }

/* ── Loading Spinner ── */
.loading {
  text-align: center;
  color: #64748b;
  padding: 2rem;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #334155;
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-inline-start: 8px;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .header { padding: 10px 14px; }
  .stats-bar { padding: 12px 14px; }
  .tabs { padding: 0 14px; }
  .tab-content { padding: 14px; }
  .tab-btn { padding: 10px 12px; font-size: .8rem; }
  .stat-card { min-width: 80px; padding: 10px 12px; }
  .stat-card .count { font-size: 1.25rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input[type="text"] { max-width: 100%; }
  .data-table { font-size: .78rem; }
  .data-table th, .data-table td { padding: 8px 6px; }
  .modal { width: 96%; }
}

/* ── Hidden utility ── */
.hidden { display: none !important; }
