/* ============================================================
   OKAIBI ADMIN - CYBER TECH STYLE
   ============================================================ */

:root {
  --bg-1: #050510;
  --bg-2: #0a0a1f;
  --bg-3: #0d0d24;
  --bg-card: #0d0d24;
  --cyan: #00d4ff;
  --purple: #8b5cf6;
  --pink: #ff006e;
  --green: #00ff88;
  --yellow: #f59e0b;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --border: rgba(255,255,255,0.07);
  --border-active: rgba(0,212,255,0.3);
  --glow-cyan: 0 0 20px rgba(0,212,255,0.2);
  --glow-purple: 0 0 20px rgba(139,92,246,0.2);
}

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

body {
  background: var(--bg-1);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
input, textarea, select, button { font-family: inherit; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--cyan); border-radius: 3px; }

/* ============ LAYOUT ============ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 240px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1rem;
  font-weight: 800;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 8px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.nav-item.active {
  color: var(--cyan);
  background: rgba(0,212,255,0.06);
  border-left-color: var(--cyan);
}

.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pink);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 0;
  transition: color 0.2s;
}

.sidebar-footer a:hover { color: #ff4477; }

/* ============ MAIN CONTENT ============ */
.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 0;
  min-height: 100vh;
}

/* ============ TOPBAR ============ */
.topbar {
  background: rgba(10,10,31,0.95);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.topbar-left h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

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

.topbar-time {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.topbar-badge {
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.2);
  color: var(--cyan);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============ PAGE CONTENT ============ */
.page-content {
  padding: 28px;
}

/* ============ STATS CARDS ============ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--glow-cyan);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.cyan { background: rgba(0,212,255,0.1); }
.stat-icon.purple { background: rgba(139,92,246,0.1); }
.stat-icon.pink { background: rgba(255,0,110,0.1); }
.stat-icon.green { background: rgba(0,255,136,0.1); }

.stat-info .num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-info .label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* ============ TABLE ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: rgba(0,212,255,0.04);
  padding: 10px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.875rem;
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .img-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.data-table .name-cell {
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-active { background: rgba(0,255,136,0.1); color: var(--green); border: 1px solid rgba(0,255,136,0.2); }
.badge-hidden { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid rgba(255,255,255,0.1); }
.badge-cyan { background: rgba(0,212,255,0.1); color: var(--cyan); border: 1px solid rgba(0,212,255,0.2); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--cyan);
  color: var(--bg-1);
  border-color: var(--cyan);
}

.btn-primary:hover { box-shadow: var(--glow-cyan); background: #33ddff; }

.btn-outline {
  background: transparent;
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
}

.btn-outline:hover { background: rgba(0,212,255,0.08); border-color: var(--cyan); }

.btn-danger {
  background: rgba(255,0,110,0.1);
  color: var(--pink);
  border-color: rgba(255,0,110,0.2);
}

.btn-danger:hover { background: rgba(255,0,110,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }

.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-lg { padding: 12px 24px; font-size: 0.9rem; }

/* ============ FORMS ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-label .required { color: var(--pink); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border 0.2s;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ============ SEARCH BAR ============ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border 0.2s;
}

.search-input:focus { border-color: var(--cyan); }

/* ============ MODAL ============ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

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

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 95%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-2);
  z-index: 1;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--bg-2);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.modal-close:hover { border-color: var(--pink); color: var(--pink); }

/* ============ IMAGE UPLOAD ============ */
.image-upload-area {
  border: 2px dashed var(--border-active);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(0,212,255,0.02);
}

.image-upload-area:hover { border-color: var(--cyan); background: rgba(0,212,255,0.05); }

.image-upload-area .icon { font-size: 2rem; margin-bottom: 8px; }
.image-upload-area .text { font-size: 0.85rem; color: var(--text-dim); }
.image-upload-area .text strong { color: var(--cyan); }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border 0.2s;
}

.preview-item.main { border-color: var(--cyan); }
.preview-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

.preview-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}

.preview-actions button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.preview-actions .del-btn { background: rgba(255,0,110,0.8); color: #fff; }
.preview-actions .main-btn { background: rgba(0,212,255,0.8); color: #fff; }

.preview-item .badge-tag {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 0.6rem;
  background: var(--cyan);
  color: var(--bg-1);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ============ VARIANT CHIPS ============ */
.variants-container { display: flex; flex-direction: column; gap: 10px; }

.variant-row {
  display: grid;
  grid-template-columns: 140px 1fr 100px 100px 40px;
  gap: 8px;
  align-items: center;
}

.variant-row .btn-remove {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,0,110,0.2);
  background: rgba(255,0,110,0.05);
  color: var(--pink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.variant-row .btn-remove:hover { background: rgba(255,0,110,0.2); }

.add-variant-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px dashed var(--border-active);
  border-radius: 8px;
  background: transparent;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.add-variant-btn:hover { background: rgba(0,212,255,0.05); border-style: solid; }

/* ============ LOGIN PAGE ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-1);
  position: relative;
}

.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo .name {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 0.1em;
}

.login-logo .sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.login-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 0.9rem; }

/* ============ TOGGLE SWITCH ============ */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: rgba(0,212,255,0.2);
  border-color: var(--cyan);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--cyan);
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ============ TAGS ============ */
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.15);
  color: var(--cyan);
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ============ LOADING ============ */
.loading-row td { text-align: center; padding: 40px; color: var(--text-dim); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }

/* ============ SECTION TABS ============ */
.section-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ============ LOGO UPLOAD ============ */
.logo-upload-area {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: var(--bg-2);
  border: 2px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.logo-upload-area:hover { border-color: var(--cyan); background: rgba(0,212,255,0.03); }

.logo-preview-box {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-1);
  font-size: 2rem;
}

.logo-preview-box img { width: 100%; height: 100%; object-fit: contain; }

.logo-upload-info .title { font-weight: 700; margin-bottom: 4px; }
.logo-upload-info .desc { font-size: 0.8rem; color: var(--text-dim); }
.logo-upload-info .status { font-size: 0.8rem; margin-top: 8px; font-weight: 600; }
.logo-upload-info .status.ok { color: var(--green); }
.logo-upload-info .status.uploading { color: var(--cyan); }

/* ============ CONTENT EDITOR ============ */
.content-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.content-section-header {
  padding: 14px 20px;
  background: rgba(0,212,255,0.03);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.content-section-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-section-body { padding: 20px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .sidebar { width: 60px; }
  .sidebar .nav-text, .sidebar .nav-section-title, .sidebar-footer span { display: none; }
  .sidebar-footer a { justify-content: center; }
  .main-content { margin-left: 60px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .variant-row { grid-template-columns: 1fr 1fr 80px 32px; }
  .variant-row .form-select { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .page-content { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .modal { width: 98%; }
}
