/* ==================== ADMIN STYLES — Polanova Robotics ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sky: #0ea5e9;
  --sky-dark: #0284c7;
  --sky-light: #e0f2fe;
  --sky-mid: #38bdf8;
  --white: #ffffff;
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --bg3: #e2e8f0;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --accent: var(--sky);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 220px;
  --font: 'Inter', sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto;
  box-shadow: 2px 0 12px rgba(2,132,199,0.15);
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.sidebar-logo a { font-size: 1.1rem; font-weight: 800; color: #fff; }
.sidebar-logo a span { color: #bae6fd; }
.sidebar-logo p { font-size: 0.7rem; color: rgba(255,255,255,0.6); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500; color: rgba(255,255,255,0.8);
  cursor: pointer; transition: all 0.2s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.15); }
.nav-item.active { color: #fff; background: rgba(255,255,255,0.22); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.15); }
.sidebar-footer a { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: rgba(255,255,255,0.65); padding: 8px 12px; border-radius: 8px; transition: all 0.2s; }
.sidebar-footer a:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.1); }

/* ---- MAIN ---- */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ---- TOPBAR ---- */
.topbar {
  padding: 20px 32px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.topbar-title h1 { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.topbar-title p { font-size: 0.8rem; color: var(--text3); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-badge {
  background: var(--sky-light); border: 1px solid #bae6fd;
  color: var(--sky-dark); font-size: 0.75rem; font-weight: 700;
  padding: 4px 12px; border-radius: 100px;
}

/* ---- CONTENT ---- */
.content { padding: 32px; flex: 1; }
.page { display: none; }
.page.active { display: block; }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.stat-card-label { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.stat-card-num { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; color: var(--text); }
.stat-card-sub { font-size: 0.8rem; color: var(--text3); }
.stat-card.green .stat-card-num { color: var(--green); }
.stat-card.accent .stat-card-num { color: var(--sky-dark); }
.stat-card.yellow .stat-card-num { color: var(--yellow); }

/* ---- SECTION HEADER ---- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-header h2 { font-size: 1rem; font-weight: 700; color: var(--text); }
.section-actions { display: flex; align-items: center; gap: 10px; }

/* ---- SEARCH / FILTER ---- */
.search-input {
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 0.85rem; outline: none; width: 220px;
  transition: border-color 0.2s; font-family: var(--font);
}
.search-input:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(14,165,233,0.1); }
.filter-select {
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text2);
  border-radius: 10px; padding: 8px 14px; font-size: 0.85rem; outline: none;
  transition: border-color 0.2s; font-family: var(--font); cursor: pointer;
}
.filter-select:focus { border-color: var(--sky); }

/* ---- TABLE ---- */
.table-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg); white-space: nowrap;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 14px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tbody tr:last-child td { border-bottom: none; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.badge-green { background: rgba(22,163,74,0.1); color: var(--green); border: 1px solid rgba(22,163,74,0.25); }
.badge-yellow { background: rgba(217,119,6,0.1); color: var(--yellow); border: 1px solid rgba(217,119,6,0.25); }
.badge-blue { background: var(--sky-light); color: var(--sky-dark); border: 1px solid #bae6fd; }
.badge-red { background: rgba(220,38,38,0.1); color: var(--red); border: 1px solid rgba(220,38,38,0.25); }
.badge-gray { background: var(--bg2); color: var(--text3); border: 1px solid var(--border); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; border: none; font-family: var(--font); white-space: nowrap; }
.btn-primary-sm { background: var(--sky); color: #fff; box-shadow: 0 2px 8px rgba(14,165,233,0.25); }
.btn-primary-sm:hover { background: var(--sky-dark); }
.btn-outline-sm { background: none; color: var(--text2); border: 1px solid var(--border2); }
.btn-outline-sm:hover { color: var(--sky-dark); border-color: var(--sky); background: var(--sky-light); }
.btn-danger-sm { background: none; color: var(--red); border: 1px solid rgba(220,38,38,0.25); }
.btn-danger-sm:hover { background: rgba(220,38,38,0.08); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform 0.3s;
  position: relative; box-shadow: var(--shadow);
}
.modal-overlay.open .modal { transform: none; }
.modal h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 24px; color: var(--text); }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg2); border: none; color: var(--text2);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: all 0.2s;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text2); letter-spacing: 0.04em; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 12px;
  color: var(--text); font-size: 0.875rem; font-family: var(--font);
  outline: none; transition: border-color 0.2s; width: 100%;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}
.modal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- DETAIL PANEL ---- */
.detail-panel {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-top: 20px;
}
.detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: var(--text2); }
.detail-row span:last-child { font-weight: 600; color: var(--text); }

/* ---- PRODUCTS ADMIN GRID ---- */
.products-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.product-admin-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.product-admin-card:hover { box-shadow: var(--shadow); border-color: #bae6fd; }
.product-admin-img {
  height: 160px; overflow: hidden; position: relative;
  background: var(--bg2);
}
.product-admin-img img { width: 100%; height: 100%; object-fit: cover; }
.product-admin-img .product-status-badge {
  position: absolute; top: 10px; right: 10px;
}
.product-admin-body { padding: 16px; }
.product-admin-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.product-admin-body p { font-size: 0.8rem; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
.product-price-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.product-price-item { display: flex; flex-direction: column; gap: 2px; }
.product-price-item .label { font-size: 0.7rem; color: var(--text3); font-weight: 600; text-transform: uppercase; }
.product-price-item .val { font-size: 0.9rem; font-weight: 700; color: var(--sky-dark); }
.product-admin-actions { display: flex; gap: 8px; }

/* ---- VIDEOS ADMIN GRID ---- */
.videos-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.video-admin-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.video-admin-card:hover { box-shadow: var(--shadow); border-color: #bae6fd; }
.video-thumb {
  height: 160px; background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; position: relative; overflow: hidden;
  cursor: pointer;
}
.video-thumb iframe {
  width: 100%; height: 100%; border: none; pointer-events: none;
}
.video-thumb .play-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.1); font-size: 3rem;
  transition: background 0.2s;
}
.video-thumb:hover .play-icon { background: rgba(0,0,0,0.2); }
.video-admin-body { padding: 16px; }
.video-admin-body h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.video-admin-body p { font-size: 0.8rem; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
.video-admin-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.video-admin-meta span { font-size: 0.75rem; color: var(--text3); }
.video-admin-actions { display: flex; gap: 8px; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 20px;
  font-size: 0.875rem; font-weight: 500; color: var(--text);
  z-index: 9999; opacity: 0; transform: translateY(10px);
  transition: all 0.3s; pointer-events: none; max-width: 320px;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: none; }
.toast.success { border-color: rgba(22,163,74,0.4); color: var(--green); }
.toast.error { border-color: rgba(220,38,38,0.4); color: var(--red); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo p, .sidebar-logo a, .nav-item span:last-child, .sidebar-footer a span:last-child { display: none; }
  .main { margin-left: 60px; }
  .content { padding: 20px 16px; }
  .topbar { padding: 16px; }
  .modal-form-row { grid-template-columns: 1fr; }
}

/* ==================== CONTENT EDITOR ==================== */
.content-editor-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 800px) { .content-editor-grid { grid-template-columns: 1fr; } }
.content-section-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 24px;
}
.content-section-card.full-width { grid-column: 1 / -1; }
.content-section-card h4 {
  font-size: 0.875rem; font-weight: 700; color: #0284c7;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}
.content-section-card h5 { font-size: 0.825rem; font-weight: 700; color: #475569; margin: 16px 0 10px; }
.section-badge {
  display: inline-block; background: #fef3c7; border: 1px solid #fcd34d;
  color: #92400e; font-size: 0.75rem; font-weight: 700;
  padding: 3px 12px; border-radius: 100px;
}

/* Upload Area */
.upload-area {
  border: 2px dashed #bae6fd; border-radius: 12px;
  padding: 40px 20px; text-align: center;
  background: #f0f9ff; cursor: pointer; transition: all 0.2s;
}
.upload-area:hover { border-color: #0284c7; background: #e0f2fe; }
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-area p { font-size: 0.875rem; color: #475569; margin-bottom: 12px; }
.upload-hint { font-size: 0.75rem; color: #94a3b8 !important; margin: 10px 0 0 !important; }
.upload-label {
  display: inline-block; padding: 8px 20px;
  background: #fff; border: 1px solid #0284c7; border-radius: 8px;
  color: #0284c7; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.upload-label:hover { background: #0284c7; color: #fff; }

/* Media Library */
.media-library { margin-top: 20px; }
#media-files-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px;
}
.media-item {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 8px; text-align: center;
}
.media-item-name {
  font-size: 0.7rem; color: #64748b; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty-cell { text-align: center; color: #94a3b8; padding: 32px; font-size: 0.875rem; }

/* ---- STAT CARD (new style) ---- */
.stat-card { display: flex; align-items: center; gap: 16px; }
.stat-icon { font-size: 1.8rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--sky-dark); }
.stat-label { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* ---- BUTTONS (btn-red-sm) ---- */
.btn-red-sm { background: none; color: var(--red); border: 1px solid rgba(220,38,38,0.25); }
.btn-red-sm:hover { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.5); }

/* ---- TOAST VARIANTS ---- */
.toast-success { border-color: rgba(22,163,74,0.4) !important; color: var(--green) !important; }
.toast-error { border-color: rgba(220,38,38,0.4) !important; color: var(--red) !important; }
.toast-show { opacity: 1 !important; transform: none !important; pointer-events: all !important; }

/* ---- VIDEOS ADMIN GRID padding ---- */
.video-admin-card { padding: 16px; }
