/* ============================================================
   ICT Hero Apps — Complete Stylesheet
   Covers: public launcher UI + admin area
   ============================================================ */

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  --color-bg:           #0a1628;
  --color-bg-2:         #0f2040;
  --color-surface:      rgba(255, 255, 255, 0.06);
  --color-surface-hover:rgba(255, 255, 255, 0.11);
  --color-border:       rgba(255, 255, 255, 0.13);
  --color-accent:       #0ea5e9;
  --color-accent-dark:  #0284c7;
  --color-text:         #f0f4f8;
  --color-text-muted:   #94a3b8;
  --color-success:      #22c55e;
  --color-warning:      #f59e0b;
  --color-danger:       #ef4444;
  --tile-radius:        20px;
  --icon-radius:        22%;
  --transition:         0.2s ease;
  --font:               'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-width:      240px;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font);
  font-size: 0.95rem;
}

img { max-width: 100%; display: block; }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ============================================================
   PUBLIC LAUNCHER UI
   ============================================================ */

#app {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-2) 100%);
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-logo {
  height: 44px;
  width: auto;
  cursor: pointer;
  transition: opacity var(--transition);
}
.app-header-logo:hover { opacity: 0.85; }

.app-header-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

/* ── Intro Banner ───────────────────────────────────────────── */
.app-intro {
  text-align: center;
  padding: 40px 24px 10px;
}
.app-intro h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 10px;
}
.app-intro p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Main content area ──────────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 24px 28px 100px;
  overflow-y: auto;
}

/* ── Tile Grid ──────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 1024px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
@media (max-width: 380px)  { .tile-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* ── Tile ───────────────────────────────────────────────────── */
.tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--tile-radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, transparent 60%);
  pointer-events: none;
}

.tile:hover {
  transform: scale(1.06);
  box-shadow: 0 0 28px rgba(14, 165, 233, 0.35), 0 8px 32px rgba(0,0,0,0.4);
  background: var(--color-surface-hover);
}

.tile:active { transform: scale(0.98); }

.tile.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.tile.disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ── Tile Icon ──────────────────────────────────────────────── */
.tile-icon-wrap {
  width: 52%;
  aspect-ratio: 1;
  border-radius: var(--icon-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, 0.15);
  margin-bottom: 14px;
  flex-shrink: 0;
  position: relative;
}

.tile-icon {
  font-size: 2rem;
  color: var(--color-accent);
  line-height: 1;
}

.tile-icon-img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  border-radius: 6px;
}

/* Category tiles get slightly bigger icons */
.tile-grid.categories .tile-icon-wrap { width: 54%; }
.tile-grid.categories .tile-icon { font-size: 2.2rem; }

/* ── Tile Text ──────────────────────────────────────────────── */
.tile-title {
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
  line-height: 1.3;
  word-break: break-word;
  max-width: 100%;
}

.tile-desc {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 4px;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Tile type badges ───────────────────────────────────────── */
.tile-type-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 99px;
  letter-spacing: 0.06em;
}
.tile-type-badge.info  { background: rgba(34,197,94,0.2);  color: #86efac; }
.tile-type-badge.folder { background: rgba(245,158,11,0.2); color: #fcd34d; }

/* ── Disabled folder overlay ────────────────────────────────── */
.tile-lock-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ── Tile Animations ────────────────────────────────────────── */
@keyframes tileIn {
  from { opacity: 0; transform: translateY(22px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tileOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-18px) scale(0.94); }
}
@keyframes tilePulse {
  0%   { box-shadow: 0 0 0 0 rgba(14,165,233,0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(14,165,233,0); }
  100% { box-shadow: 0 0 0 0 rgba(14,165,233,0); }
}

.tile { animation: tileIn 0.35s ease both; }
.tile.exiting { animation: tileOut 0.2s ease both; }
.tile.pulse-highlight { animation: tilePulse 0.8s ease 2; }

/* ── Bottom Dock ────────────────────────────────────────────── */
.app-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 22, 40, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 200;
  transition: transform var(--transition);
}

.app-dock.hidden { transform: translateY(100%); }

.dock-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  flex: 1;
}

/* ── Share FAB ───────────────────────────────────────────────── */
.share-fab {
  position: fixed;
  bottom: 72px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 210;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.45);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.share-fab:hover {
  transform: scale(1.1);
  background: var(--color-accent-dark);
  box-shadow: 0 6px 28px rgba(14, 165, 233, 0.65);
}
.share-fab:active { transform: scale(0.94); }

/* ── Share Bottom-Sheet ──────────────────────────────────────── */
.share-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.share-sheet-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.share-sheet {
  background: linear-gradient(160deg, #0f2040, #0a1628);
  border: 1px solid var(--color-border);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 12px 24px 36px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.5);
}
.share-sheet-backdrop.open .share-sheet { transform: translateY(0); }

.share-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 auto 18px;
}

.share-sheet-title {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  color: var(--color-text);
}

.share-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.share-sheet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  font-family: var(--font);
}
.share-sheet-btn:hover { background: rgba(255,255,255,0.12); text-decoration: none; color: var(--color-text); }
.share-sheet-btn:active { transform: scale(0.95); }

.share-sheet-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--color-accent);
}
.share-sheet-btn.share-whatsapp .share-sheet-icon { background: rgba(37,211,102,0.12); color: #25d366; }
.share-sheet-btn.share-telegram .share-sheet-icon { background: rgba(0,136,204,0.12);  color: #0088cc; }
.share-sheet-btn.share-copy.copied .share-sheet-icon { background: rgba(34,197,94,0.15); color: #4ade80; }

.share-sheet-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.share-sheet-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}
.share-sheet-footer a { color: var(--color-text-muted); }
.share-sheet-footer a:hover { color: var(--color-accent); text-decoration: none; }

.dock-breadcrumb .crumb-home {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition);
}
.dock-breadcrumb .crumb-home:hover { color: var(--color-text); }

.dock-breadcrumb .crumb-sep {
  color: rgba(255,255,255,0.25);
  font-size: 0.75rem;
}

.dock-breadcrumb .crumb-current {
  color: var(--color-text);
  font-weight: 600;
}

.dock-home-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(14,165,233,0.15);
  border: 1px solid rgba(14,165,233,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.dock-home-btn:hover {
  background: rgba(14,165,233,0.3);
  box-shadow: 0 0 12px rgba(14,165,233,0.4);
}

/* ── Footer ─────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 14px 24px 90px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.app-footer a { color: var(--color-text-muted); }
.app-footer a:hover { color: var(--color-accent); }

/* ── Back bar ───────────────────────────────────────────────── */
.back-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 18px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.back-bar-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ── Section heading ────────────────────────────────────────── */
.section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  padding-left: 4px;
}

/* ── Loading state ──────────────────────────────────────────── */
.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 16px;
  color: var(--color-text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error state ────────────────────────────────────────────── */
.app-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.app-error i { font-size: 2.5rem; color: var(--color-danger); margin-bottom: 12px; }

/* ============================================================
   MODALS (Public)
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition);
}
.modal-backdrop.visible { opacity: 1; }

.modal-card {
  background: linear-gradient(145deg, #0d1f3c, #0a1628);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-backdrop.visible .modal-card { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.07);
  color: var(--color-text-muted);
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid var(--color-border);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.14); color: var(--color-text); }

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-right: 40px;
}

.modal-body {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.modal-body p + p { margin-top: 10px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #1a2e4a;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 0.9rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  pointer-events: all;
  max-width: 320px;
  animation: toastIn 0.3s ease both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

.toast.exiting { animation: toastOut 0.25s ease both; }
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-danger); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.info    { border-left: 3px solid var(--color-accent); }
.toast i { font-size: 0.95rem; flex-shrink: 0; }
.toast.success i { color: var(--color-success); }
.toast.error   i { color: var(--color-danger); }
.toast.warning i { color: var(--color-warning); }
.toast.info    i { color: var(--color-accent); }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */

.admin-body {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--color-bg) 0%, #0c1a30 100%);
  display: flex;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.admin-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: rgba(0,0,0,0.3);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo-wrap {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
  width: 100%;
  max-width: 160px;
  height: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav-link i {
  width: 16px;
  text-align: center;
  font-size: 0.9rem;
}

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

.sidebar-nav-link.active {
  background: rgba(14,165,233,0.1);
  color: var(--color-accent);
  border-left-color: var(--color-accent);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ── Admin Main ─────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-topbar h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

.admin-content {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

/* ── Cards ──────────────────────────────────────────────────── */
.admin-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

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

.admin-card-title {
  font-size: 1rem;
  font-weight: 700;
}

/* ── Two-panel Designer ─────────────────────────────────────── */
.designer-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .designer-layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--color-border);
}

.panel-header-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.panel-body {
  padding: 8px 0;
  min-height: 200px;
}

.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  text-align: center;
  min-height: 200px;
}
.panel-empty i { font-size: 1.8rem; opacity: 0.4; }

/* ── Row items (categories + apps) ─────────────────────────── */
.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition);
}

.row-item:last-child { border-bottom: none; }
.row-item:hover { background: rgba(255,255,255,0.04); }
.row-item.selected { background: rgba(14,165,233,0.12); border-left: 3px solid var(--color-accent); }

.row-drag-handle {
  color: rgba(255,255,255,0.25);
  font-size: 0.85rem;
  cursor: grab;
  padding: 0 2px;
  flex-shrink: 0;
}

.row-icon-preview {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(14,165,233,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--color-accent);
  flex-shrink: 0;
}

.row-icon-preview img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 3px;
}

.row-info {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

.row-meta {
  font-size: 0.74rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Pill badges ────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-url    { background: rgba(14,165,233,0.2);  color: #7dd3fc; }
.badge-folder { background: rgba(245,158,11,0.2);  color: #fcd34d; }
.badge-info   { background: rgba(34,197,94,0.2);   color: #86efac; }
.badge-count  { background: rgba(255,255,255,0.08); color: var(--color-text-muted); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-dark);
  box-shadow: 0 0 16px rgba(14,165,233,0.4);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  text-decoration: none;
  color: var(--color-text);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.3);
  text-decoration: none;
  color: #fca5a5;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.8rem;
  border-radius: 7px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  background: rgba(255,255,255,0.05);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: var(--color-text); }
.btn-icon.btn-icon-danger:hover { background: rgba(239,68,68,0.2); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.btn-icon.btn-icon-edit:hover { background: rgba(14,165,233,0.2); color: var(--color-accent); border-color: rgba(14,165,233,0.3); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--color-text);
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

.form-control::placeholder { color: rgba(255,255,255,0.2); }

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

.form-control-muted {
  background: rgba(0,0,0,0.15);
  color: var(--color-text-muted);
}

.form-help {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 5px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--color-danger);
  margin-top: 5px;
}

/* Radio/type selector */
.type-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  background: rgba(0,0,0,0.2);
  font-size: 0.88rem;
  transition: background var(--transition), border-color var(--transition);
}

.type-option:hover { background: rgba(255,255,255,0.05); }
.type-option input { display: none; }
.type-option.selected { border-color: var(--color-accent); background: rgba(14,165,233,0.1); color: var(--color-accent); }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  transition: background var(--transition);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}

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

/* Password strength */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  margin-top: 6px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}

.strength-label {
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--color-text-muted);
}

/* ── Admin Modals ───────────────────────────────────────────── */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 800;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.admin-modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.admin-modal {
  background: linear-gradient(160deg, #0f2040, #0a1628);
  border: 1px solid var(--color-border);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 28px 32px;
  transform: translateY(30px);
  transition: transform var(--transition);
  box-shadow: 0 -8px 60px rgba(0,0,0,0.5);
}

.admin-modal-backdrop.open .admin-modal { transform: translateY(0); }

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

.admin-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Icon Picker ────────────────────────────────────────────── */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}

.icon-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  background: rgba(0,0,0,0.2);
  transition: background var(--transition), border-color var(--transition);
  text-align: center;
}

.icon-picker-item:hover {
  background: rgba(14,165,233,0.1);
  border-color: rgba(14,165,233,0.4);
}

.icon-picker-item i {
  font-size: 1.2rem;
  color: var(--color-accent);
}

.icon-picker-item span {
  font-size: 0.62rem;
  color: var(--color-text-muted);
  line-height: 1.2;
  word-break: break-all;
}

.icon-picker-search {
  margin-bottom: 14px;
  position: relative;
}

.icon-picker-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.icon-picker-search input {
  padding-left: 36px;
}

/* ── Admin icon browser (icons.php) ─────────────────────────── */
.icon-browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.icon-browser-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  background: rgba(0,0,0,0.2);
  transition: background var(--transition), border-color var(--transition);
  text-align: center;
}

.icon-browser-item:hover {
  background: rgba(14,165,233,0.1);
  border-color: rgba(14,165,233,0.4);
}

.icon-browser-item i {
  font-size: 1.4rem;
  color: var(--color-accent);
}

.icon-browser-item span {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  word-break: break-all;
  line-height: 1.3;
}

.icon-category-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

/* ── Login page ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.4);
}

.login-logo {
  display: block;
  max-width: 180px;
  height: auto;
  margin: 0 auto 28px;
}

.login-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.login-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: #fca5a5;
  margin-bottom: 16px;
}

.login-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: #86efac;
  margin-bottom: 16px;
}

.login-lockout {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.88rem;
  color: #fcd34d;
  margin-bottom: 16px;
  text-align: center;
}

.login-footer-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.83rem;
  color: var(--color-text-muted);
}

.login-footer-links a { color: var(--color-accent); }

/* Favicon finder */
.favicon-preview-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  margin-top: 14px;
}

.favicon-preview-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.favicon-preview-url {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

/* ── Alert banners ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.3);  color: #86efac; }
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info    { background: rgba(14,165,233,0.1); border: 1px solid rgba(14,165,233,0.3); color: #7dd3fc; }

/* Inline icon-value display */
.icon-field-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-field-preview {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(14,165,233,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 1rem;
  flex-shrink: 0;
  border: 1px solid rgba(14,165,233,0.25);
}

/* ── Utilities ──────────────────────────────────────────────── */
.d-flex       { display: flex; }
.d-none       { display: none !important; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-12        { margin-top: 12px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }
.text-muted   { color: var(--color-text-muted); }
.text-center  { text-align: center; }
.text-small   { font-size: 0.82rem; }
.fw-bold      { font-weight: 700; }
.w-full       { width: 100%; }

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-content { padding: 16px; }
  .designer-layout { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .admin-modal { padding: 20px 16px 28px; }
  .login-card  { padding: 28px 20px; }
}
