/* =========================================
   LOOPIX-DEV PORTFOLIO — ADMIN STYLESHEET
   ========================================= */

.admin-body, .auth-body {
  cursor: auto;
  min-height: 100vh;
}
.admin-body button { cursor: pointer; }

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}
.auth-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 56px; height: 56px;
  background: var(--cyan-glow);
  border: 1px solid rgba(34,211,238,0.15);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--cyan);
}
.auth-logo-icon svg { width: 26px; height: 26px; }
.auth-logo-text { font-family: var(--font-heading); font-size: 22px; margin-bottom: 4px; font-weight: 800; }
.auth-logo p { color: var(--text-muted); font-size: 13px; font-weight: 500; }

.auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: #dc2626;
  margin-bottom: 20px;
}
.auth-alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-alert.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}
.auth-footer a { color: var(--cyan); transition: opacity 0.2s; }
.auth-footer a:hover { opacity: 0.7; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}
.required { color: #ef4444; }
.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  transition: var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--cyan);
  background: var(--cyan-glow);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.06);
}
.form-input::placeholder { color: var(--text-muted); }
.input-wrapper .form-input { padding-left: 42px; }
.toggle-pass {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
}
.toggle-pass svg { width: 16px; height: 16px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(161,161,170,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}
.form-select option { background: #fff; }
.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.image-upload-wrapper { position: relative; }
.image-preview {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 100px;
  justify-content: center;
  background: var(--bg);
}
.image-preview:hover { border-color: var(--cyan); color: var(--cyan); }
.image-preview svg { width: 28px; height: 28px; }
.image-preview img { max-height: 120px; border-radius: 8px; object-fit: cover; width: 100%; }
.image-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%; height: 100%;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.sidebar {
  width: 260px;
  background: rgba(255,255,255,0.96);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  transition: transform var(--transition);
  backdrop-filter: blur(20px);
}
.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-logo { font-family: var(--font-heading); font-size: 17px; font-weight: 800; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer; }
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-link.active { background: var(--cyan-glow); color: var(--cyan); border: 1px solid rgba(34,211,238,0.1); }
.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.sidebar-avatar {
  width: 36px; height: 36px;
  background: var(--grad-1);
  color: #fff;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  font-family: var(--font-heading);
}
.sidebar-username { font-size: 13px; font-weight: 700; }
.sidebar-role { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  color: #dc2626;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
}
.btn-logout svg { width: 15px; height: 15px; }
.btn-logout:hover { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2); }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
  display: none;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

.admin-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.admin-topbar {
  position: sticky;
  top: 0;
  background: rgba(248,250,252,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 100;
}
.topbar-menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.topbar-menu span { display: block; width: 20px; height: 2px; background: var(--text-dim); border-radius: 2px; }
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: var(--cyan-glow);
  border: 1px solid rgba(34,211,238,0.1);
  border-radius: 100px;
  font-size: 12px;
  color: var(--cyan);
  font-weight: 600;
}

.admin-page { display: none; padding: 32px 28px; }
.admin-page.active { display: block; }

.admin-welcome { margin-bottom: 32px; }
.admin-welcome h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.admin-welcome h2 span { background: var(--grad-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.admin-welcome p { color: var(--text-dim); font-size: 15px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { border-color: rgba(34,211,238,0.12); transform: translateY(-2px); }
.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon svg { width: 20px; height: 20px; }
.stat-card-icon.green { background: var(--cyan-glow); color: var(--cyan); border: 1px solid rgba(34,211,238,0.1); }
.stat-card-icon.blue { background: rgba(96,165,250,0.1); color: #60a5fa; border: 1px solid rgba(96,165,250,0.15); }
.stat-card-icon.purple { background: rgba(139,92,246,0.1); color: var(--violet); border: 1px solid rgba(139,92,246,0.15); }
.stat-card-icon.orange { background: rgba(245,158,11,0.1); color: var(--amber); border: 1px solid rgba(245,158,11,0.15); }
.stat-card-value { font-size: 22px; font-weight: 800; font-family: var(--font-heading); }
.stat-card-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

.dashboard-actions { margin-bottom: 32px; }
.dashboard-actions h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text-dim); }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.quick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.quick-btn svg { width: 16px; height: 16px; color: var(--cyan); }
.quick-btn:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }

.dashboard-recent h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text-dim); }
.recent-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  transition: var(--transition);
}
.recent-row:hover { border-color: rgba(34,211,238,0.1); }
.recent-img {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.recent-info { flex: 1; min-width: 0; }
.recent-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-desc { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-version {
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  background: var(--cyan-glow);
  padding: 3px 10px;
  border-radius: 100px;
  flex-shrink: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-header h2 { font-size: 24px; font-weight: 800; }
.page-header p { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.table-search {
  position: relative;
  flex: 1;
  max-width: 340px;
}
.table-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--cyan); background: var(--cyan-glow); }
.search-input::placeholder { color: var(--text-muted); }
.table-count { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}
.admin-table th {
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr { transition: background var(--transition); }
.admin-table tr:hover td { background: var(--surface-hover); }
.table-name { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.table-thumb {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-3);
  flex-shrink: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.table-version {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  background: var(--cyan-glow);
  padding: 3px 10px;
  border-radius: 100px;
  display: inline-block;
}
.table-category {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table-desc {
  color: var(--text-dim);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-link {
  color: #60a5fa;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 120px;
}
.table-link:hover { text-decoration: underline; }
.table-actions { display: flex; gap: 8px; }
.action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.action-btn svg { width: 14px; height: 14px; }
.action-btn.edit:hover { border-color: #60a5fa; color: #60a5fa; background: rgba(96,165,250,0.08); }
.action-btn.delete:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.08); }

.table-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.admin-modal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition);
}
.modal-overlay.active .admin-modal-card { transform: translateY(0) scale(1); }
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.admin-modal-header h3 { font-size: 18px; font-weight: 800; }
.admin-modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.admin-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: #fff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.confirm-card {
  background: #fff;
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition);
}
.modal-overlay.active .confirm-card { transform: translateY(0) scale(1); }
.confirm-icon {
  width: 56px; height: 56px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #ef4444;
}
.confirm-icon svg { width: 24px; height: 24px; }
.confirm-card h3 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.confirm-card p { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 28px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  animation: toastIn 0.3s ease both;
  pointer-events: all;
  min-width: 240px;
  max-width: 340px;
}
.toast.success { border-color: rgba(34,211,238,0.2); color: var(--cyan); }
.toast.error { border-color: rgba(239,68,68,0.2); color: #dc2626; }
.toast.info { border-color: rgba(96,165,250,0.2); color: #3b82f6; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.out { animation: toastOut 0.3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .admin-main { margin-left: 0; }
  .topbar-menu { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .admin-page { padding: 20px 16px; }
  .admin-topbar { padding: 14px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-search { max-width: 100%; }
  .auth-card { padding: 28px 20px; }
  .confirm-actions { flex-direction: column; }
  .version-add .form-row { grid-template-columns: 1fr !important; }
}

/* ===== STATUS TOGGLE ===== */
.status-toggle {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.status-toggle.active {
  background: rgba(34,197,94,0.08);
  color: #16a34a;
  border-color: rgba(34,197,94,0.2);
}
.status-toggle.active:hover {
  background: rgba(239,68,68,0.08);
  color: #dc2626;
  border-color: rgba(239,68,68,0.2);
}
.status-toggle.inactive {
  background: rgba(239,68,68,0.06);
  color: #dc2626;
  border-color: rgba(239,68,68,0.12);
}
.status-toggle.inactive:hover {
  background: rgba(34,197,94,0.08);
  color: #16a34a;
  border-color: rgba(34,197,94,0.2);
}

/* ===== VERSION PANEL ===== */
.version-panel {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.version-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.version-panel-header h3 { font-size: 18px; font-weight: 800; }
.version-list { margin-bottom: 16px; }
.version-add {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.action-btn.versions:hover {
  border-color: var(--violet);
  color: var(--violet);
  background: rgba(109,40,217,0.06);
}
