/* Leadernace Admin - Same design tokens as frontend */
:root {
  --color-bg: #080a14;
  --color-card: #0d1220;
  --color-card-hover: rgba(18, 23, 34, 0.95);
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.75);
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-strong: rgba(255, 255, 255, 0.3);
  --font-primary: 'Portada ARA', 'Noto Kufi Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-primary);
  background-color: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Links — no underline globally */
a { text-decoration: none; color: inherit; }

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: var(--color-card);
  border-left: 1px solid var(--color-border);
  padding: 24px 0;
  flex-shrink: 0;
}

.admin-sidebar .brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 18px;
}

.admin-sidebar .nav-link {
  display: block;
  padding: 12px 24px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}

.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
}

.admin-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 13px;
  padding: 24px;
  margin-bottom: 24px;
}

.admin-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
}

/* ========== Form System ========== */

/* Single field: label on top, input below */
.admin-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

/* Two-column row */
.admin-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-form .form-row .form-group {
  margin-bottom: 0;
}

/* Labels */
.admin-form label,
.admin-form .form-group label {
  display: block;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

/* Text inputs, textareas */
.form-control,
.admin-form .form-control,
.admin-form textarea.form-control {
  display: block;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  border-radius: 7px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Select / dropdown */
.admin-form .form-select,
.form-select {
  display: block;
  width: 100%;
  background-color: #0d1220;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 12px 8px;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  border-radius: 7px;
  padding: 10px 14px;
  padding-left: 36px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Dropdown options — dark background */
.admin-form .form-select option,
.form-select option {
  background: #0d1220;
  color: #ffffff;
  padding: 8px 12px;
}

.form-control:focus,
.admin-form .form-control:focus,
.admin-form .form-select:focus,
.form-select:focus,
.admin-form textarea.form-control:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.form-control:disabled,
.admin-form .form-control:disabled,
.admin-form .form-select:disabled,
.form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-control::placeholder,
.admin-form .form-control::placeholder {
  color: var(--color-text-muted);
}

/* Search inputs */
.admin-form input[type="search"],
input[type="search"].form-control {
  display: block;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  border-radius: 7px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="search"].form-control:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

input[type="search"].form-control::placeholder {
  color: var(--color-text-muted);
}

/* Date/time inputs dark theme */
.admin-form input[type="date"],
.admin-form input[type="datetime-local"],
.admin-form input[type="time"] {
  color-scheme: dark;
}

/* File input */
.admin-form input[type="file"].form-control {
  padding: 8px 14px;
  cursor: pointer;
}

.admin-form input[type="file"].form-control::file-selector-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  border-radius: 5px;
  padding: 4px 12px;
  margin-left: 12px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.admin-form input[type="file"].form-control::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Checkbox / toggle */
.admin-form .form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  cursor: pointer;
}

.admin-form .form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.admin-form .form-check span {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Inline checkboxes row */
.admin-form .form-checks-row {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.admin-form .form-checks-row .form-check {
  margin-bottom: 0;
}

/* Small hints */
.admin-form .form-hint {
  color: var(--color-text-muted);
  font-size: 12px;
  margin: 0;
}

/* Validation errors */
.admin-form .form-error {
  color: #f87171;
  font-size: 12px;
}

/* Form actions row */
.admin-form .form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* ========== Buttons ========== */
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  padding: 10px 24px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-admin:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-admin-primary {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-admin-primary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-admin-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ========== Login page ========== */
.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 13px;
  padding: 40px;
}

.admin-login-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px;
  text-align: center;
}

.admin-login-card .subtitle {
  color: var(--color-text-muted);
  font-size: 14px;
  text-align: center;
  margin-bottom: 32px;
}

.admin-login-card .alert-danger {
  background: rgba(220, 53, 69, 0.2);
  border: 1px solid rgba(220, 53, 69, 0.5);
  color: #f8d7da;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* ========== Tables ========== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--color-text);
}

.admin-table th,
.admin-table td {
  padding: 12px;
  text-align: right;
}

.admin-table th {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text-muted);
}

.admin-table tr {
  border-bottom: 1px solid var(--color-border);
}

/* ========== Stats ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 13px;
  padding: 20px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-card .label {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ========== Modal overlay ========== */
.admin-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.admin-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  min-width: 320px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ========== Livewire Loading ========== */
.opacity-50 { opacity: 0.5; pointer-events: none; }

/* ========== Admin Toolbar ========== */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.admin-toolbar .form-control,
.admin-toolbar .form-select {
  width: auto;
  min-width: 160px;
}

/* ========== Admin Pagination ========== */
.admin-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.admin-pagination-info {
  color: var(--color-text-muted);
  font-size: 13px;
}
.admin-pagination-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
}
.admin-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.admin-page-btn:hover:not(.is-disabled):not(.is-active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.admin-page-btn.is-active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--color-text);
  font-weight: 600;
}
.admin-page-btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ========== Admin Modal (Livewire) ========== */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-modal-content {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 13px;
  padding: 24px;
  min-width: 360px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ========== Status Badges ========== */
.badge-active { color: #4ade80; }
.badge-inactive { color: var(--color-text-muted); }
.badge-low-stock { color: #fbbf24; }
.badge-out-of-stock { color: #f87171; }
