/* =============================================================
   ADMIN PANEL — admin.css
   ============================================================= */

:root {
  --c-bg:        #0f172a;
  --c-surface:   #1e293b;
  --c-surface2:  #263148;
  --c-border:    #334155;
  --c-primary:   #4f46e5;
  --c-primary-h: #4338ca;
  --c-danger:    #ef4444;
  --c-success:   #22c55e;
  --c-text:      #f1f5f9;
  --c-muted:     #94a3b8;
  --c-input-bg:  #0f172a;
  --radius:      0.6rem;
  --transition:  0.2s ease;
  --sidebar-w:   200px;
  --header-h:    60px;
}

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

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.btn:active { opacity: 0.85; }

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--c-primary-h); }

.btn-outline {
  border-color: var(--c-border);
  background: transparent;
  color: var(--c-muted);
}
.btn-outline:hover { border-color: var(--c-muted); color: var(--c-text); }

.btn-danger {
  background: transparent;
  border-color: var(--c-danger);
  color: var(--c-danger);
}
.btn-danger:hover { background: var(--c-danger); color: #fff; }

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

/* ── Login Screen ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 1rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-logo {
  font-size: 2.5rem;
  color: var(--c-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.4rem;
}

.login-sub {
  font-size: 0.88rem;
  color: var(--c-muted);
  text-align: center;
  margin-bottom: 1.75rem;
}

/* ── Form Fields ── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1.1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-group input,
.field-group textarea,
.field-group select {
  background: var(--c-input-bg);
  border: 1.5px solid var(--c-border);
  border-radius: 0.45rem;
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--c-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
}

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

.field-hint {
  font-size: 0.77rem;
  color: var(--c-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Error / Status messages ── */
.error-msg {
  font-size: 0.85rem;
  color: var(--c-danger);
  font-weight: 600;
  min-height: 1.2em;
  margin-bottom: 0.75rem;
}

.save-status {
  font-size: 0.83rem;
  font-weight: 600;
  padding: 0 1.5rem 0.5rem;
  min-height: 1.2em;
}

.save-status.success { color: var(--c-success); }
.save-status.error   { color: var(--c-danger); }
.save-status.info    { color: var(--c-muted); }

/* ── Login button full width ── */
#login-btn { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* ── Dashboard Layout ── */
.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.dash-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--header-h);
  gap: 1rem;
}

.dash-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--c-text);
}

.dash-header-actions { display: flex; gap: 0.75rem; }

.dash-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.dash-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  color: var(--c-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: color var(--transition), background var(--transition);
  border-radius: 0;
}

.tab-btn:hover { background: var(--c-surface2); color: var(--c-text); }

.tab-btn.active {
  background: rgba(79,70,229,0.15);
  color: #818cf8;
  border-right: 3px solid var(--c-primary);
}

/* ── Content Area ── */
.dash-content {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
}

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

.tab-panel h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--c-border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--c-border);
}

.panel-header h2 { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

/* ── Item Cards (list entries) ── */
.item-list { display: flex; flex-direction: column; gap: 1rem; }

.item-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem;
  background: var(--c-surface2);
  cursor: pointer;
  gap: 0.75rem;
}

.item-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.item-card-body {
  padding: 1.25rem 1.1rem;
  display: none;
}

.item-card-body.open { display: block; }

.item-drag-handle {
  color: var(--c-muted);
  cursor: grab;
  font-size: 0.9rem;
  padding: 0 0.2rem;
  flex-shrink: 0;
}

/* ── Tags input helper ── */
.tags-hint {
  font-size: 0.77rem;
  color: var(--c-muted);
  margin-top: 0.2rem;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .field-row { grid-template-columns: 1fr; }

  .dash-body { flex-direction: column; }

  .dash-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
  }

  .tab-btn {
    flex-shrink: 0;
    border-right: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 0.85rem;
  }

  .tab-btn.active {
    border-right: none;
    border-bottom: 3px solid var(--c-primary);
  }

  .dash-content { padding: 1.25rem; }
}
