/* ── Polymorf Admin Panel ── */
:root {
  --bg-dark: #0a0a0f;
  --bg-card: #111118;
  --bg-sidebar: #0d0d14;
  --accent: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --accent-light: #a78bfa;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: rgba(124, 58, 237, 0.2);
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 8px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── Login ── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

textarea { resize: vertical; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: #6d28d9; }

.btn--secondary {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid var(--border);
}
.btn--secondary:hover { background: rgba(124, 58, 237, 0.1); }

.btn--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn--danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn--sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn--full { width: 100%; }

/* ── Dashboard Layout ── */
.dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}

.sidebar__brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar__brand h2 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--accent-light);
}

.sidebar__brand span {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar__nav {
  list-style: none;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 0.7rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(124, 58, 237, 0.05);
}

.nav-link.active {
  color: var(--accent-light);
  border-left-color: var(--accent);
  background: rgba(124, 58, 237, 0.08);
}

.sidebar__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Content ── */
.content {
  padding: 2rem;
  overflow-y: auto;
  max-height: 100vh;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-panel h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-size: 1.05rem;
  color: var(--accent-light);
  margin-bottom: 1rem;
}

/* ── Camera Preview ── */
.preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.preview-box {
  text-align: center;
}

.preview-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.preview-box video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* ── Gallery ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.gallery-item__info {
  padding: 0.6rem;
}

.gallery-item__info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gallery-item__actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.gallery-empty {
  color: var(--text-muted);
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast--success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.toast--error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--danger);
}

.toast--info {
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: var(--accent-light);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
  }
  .sidebar__brand { display: none; }
  .sidebar__nav { display: flex; gap: 0; }
  .nav-link { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav-link.active { border-bottom-color: var(--accent); border-left: none; }
  .sidebar__footer { flex-direction: row; border-top: none; }
}
