/* ═══════════════════════════════════════════════════════════
   MANZIL ADMIN — Components
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.btn i { font-size: 12px; }
.btn-primary {
  background: var(--text);
  color: var(--surface);
}
.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
html[data-theme="dark"] .btn-primary {
  background: var(--teal);
  color: #0B0B0A;
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
.btn-teal {
  background: var(--teal);
  color: #fff;
}
.btn-teal:hover {
  background: var(--teal-hover);
  transform: translateY(-1px);
}
html[data-theme="dark"] .btn-teal { color: #0B0B0A; }
.btn-danger {
  background: var(--red-soft);
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
}
.btn-sm { height: 30px; padding: 0 10px; font-size: 11.5px; }
.btn-full { width: 100%; }

/* ═══════════════ PANELS ═══════════════ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-head {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
.panel-sub {
  font-size: 11.5px;
  color: var(--text-4);
  margin-top: 2px;
  font-weight: 500;
}
.panel-body { padding: 22px; }
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════ STATS ═══════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: all 0.2s var(--ease);
}
.stat:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.stat-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.stat-value.mono {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
}
.stat-sub {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-sub .up {
  color: var(--green);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 10.5px;
}
.stat-sub .down {
  color: var(--red);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 10.5px;
}

/* ═══════════════ TABLES ═══════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 22px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background 0.15s var(--ease);
  cursor: pointer;
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .r {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.data-table .strong { color: var(--text); font-weight: 600; }
.data-table .mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ═══════════════ TAGS / BADGES ═══════════════ */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }
.tag.gray { background: var(--surface-2); color: var(--text-3); }
.tag.teal { background: var(--teal-soft); color: var(--teal); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge.dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge.online { background: var(--green-soft); color: var(--green); }
.badge.offline { background: var(--surface-2); color: var(--text-3); }
.badge.verified { background: var(--blue-soft); color: var(--blue); }
.badge.gold { background: var(--amber-soft); color: var(--amber); }
.badge.suspended { background: var(--red-soft); color: var(--red); }

/* ═══════════════ CHIPS ═══════════════ */
.chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-3);
  transition: all 0.15s var(--ease);
  letter-spacing: -0.005em;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--text);
  color: var(--surface);
}
html[data-theme="dark"] .chip.active {
  background: var(--teal);
  color: #0B0B0A;
}

/* ═══════════════ TABS ═══════════════ */
.tabs-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 6px;
  margin-bottom: 20px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-wrap::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
}
.tab i { font-size: 12px; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active {
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
}
html[data-theme="dark"] .tab.active {
  background: var(--teal);
  color: #0B0B0A;
}
.tab .badge-mini {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  letter-spacing: 0;
}
.tab.active .badge-mini {
  background: var(--surface);
  color: var(--text);
}
html[data-theme="dark"] .tab.active .badge-mini {
  background: #0B0B0A;
  color: var(--teal);
}

/* ═══════════════ TOOLBAR / SEARCH ═══════════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-inline {
  flex: 1;
  min-width: 220px;
  position: relative;
  max-width: 420px;
}
.search-inline i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  font-size: 13px;
  pointer-events: none;
}
.search-inline input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: all 0.15s var(--ease);
}
.search-inline input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
.search-inline input::placeholder { color: var(--text-4); }

/* ═══════════════ FORMS ═══════════════ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: all 0.15s var(--ease);
  font-size: 13px;
}
.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
textarea.form-input {
  height: auto;
  min-height: 90px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ═══════════════ INFO GRID ═══════════════ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 32px;
}
@media (max-width: 900px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .info-grid { grid-template-columns: 1fr; gap: 18px; }
}
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.info-value {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.005em;
  word-break: break-word;
}
.info-value.mono {
  font-family: var(--mono);
  font-size: 13px;
}

/* ═══════════════ TOAST ═══════════════ */
.toast-root {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--surface);
  padding: 11px 20px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  animation: toastIn 0.3s var(--ease-out);
  pointer-events: auto;
  max-width: 90vw;
  text-align: center;
}
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }
.toast.warning { background: var(--amber); color: #fff; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════ MODAL ═══════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 12, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s var(--ease-out);
}
html[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.25s var(--ease-out);
}
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }
.modal-sm { max-width: 400px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.modal-sub {
  font-size: 12px;
  color: var(--text-4);
  margin-top: 2px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-2);
}
/* ═══════════════════════════════════════════════════════════
   UNIVERSAL MODAL SYSTEM
   ═══════════════════════════════════════════════════════════ */

.mz-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
  animation: mzFadeIn 0.2s ease;
}

.mz-modal-card {
  background: #fff;
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 48px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mzSlideUp 0.25s ease;
}

.mz-modal-card.mz-modal-lg { max-width: 900px; }
.mz-modal-card.mz-modal-sm { max-width: 440px; }

.mz-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  flex-shrink: 0;
}

.mz-modal-header h2,
.mz-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

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

.mz-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #fafafa;
  flex-shrink: 0;
}

.mz-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.15s;
}

.mz-modal-close:hover {
  background: #e5e5e5;
  color: #111;
}

@keyframes mzFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mzSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL SEARCH MODAL
   ═══════════════════════════════════════════════════════════ */

.gs-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: gsFadeIn 0.15s ease;
}

.gs-modal.gs-closing {
  animation: gsFadeOut 0.15s ease;
}

@keyframes gsFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes gsFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.gs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.gs-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 70vh;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3),
              0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gsSlideIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gsSlideIn {
  from { transform: scale(0.95) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- Input ---------- */
.gs-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.gs-search-icon {
  color: var(--text-4);
  font-size: 16px;
  flex-shrink: 0;
}

.gs-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  padding: 0;
}

.gs-input::placeholder {
  color: var(--text-4);
}

.gs-kbd {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-3);
  border: 1px solid var(--border);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ---------- Results ---------- */
.gs-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}

.gs-results::-webkit-scrollbar {
  width: 6px;
}

.gs-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Empty state */
.gs-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-4);
}

.gs-empty i {
  font-size: 40px;
  opacity: 0.3;
  margin-bottom: 12px;
  display: block;
}

.gs-empty p {
  font-size: 13px;
  margin: 0;
}

/* Loading */
.gs-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-4);
}

.gs-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: gsSpin 0.7s linear infinite;
  margin: 0 auto 12px;
}

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

.gs-loading p {
  font-size: 13px;
  margin: 0;
}

/* ---------- Group ---------- */
.gs-group {
  margin-bottom: 4px;
}

.gs-group-label {
  padding: 10px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-4);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gs-group-label i {
  font-size: 11px;
}

/* ---------- Result item ---------- */
.gs-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.gs-result-item:hover,
.gs-result-item.selected {
  background: var(--surface-2);
}

.gs-result-item.selected {
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}

.gs-result-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 14px;
  flex-shrink: 0;
}

.gs-result-item.selected .gs-result-icon {
  background: var(--text);
  color: var(--surface);
}

.gs-result-body {
  flex: 1;
  min-width: 0;
}



.gs-result-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gs-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--text);
  color: var(--surface);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.gs-result-subtitle {
  font-size: 11.5px;
  color: var(--text-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gs-result-arrow {
  color: var(--text-4);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.1s, transform 0.1s;
  flex-shrink: 0;
}

.gs-result-item.selected .gs-result-arrow,
.gs-result-item:hover .gs-result-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ---------- Footer ---------- */
.gs-footer {
  border-top: 1px solid var(--border);
  padding: 10px 20px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.gs-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-4);
  flex-wrap: wrap;
}

.gs-hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-3);
  border: 1px solid var(--border);
  margin-left: 4px;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .gs-modal {
    padding-top: 0;
  }

  .gs-panel {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .gs-footer {
    display: none;
  }
}