/* Admin panel styles — reuses tokens from ../css/style.css (loaded first) */

body.admin-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 700px 400px at 20% 0%, rgba(138,107,255,0.12), transparent 60%),
    radial-gradient(ellipse 700px 400px at 100% 100%, rgba(0,229,199,0.10), transparent 60%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(18, 23, 31, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.login-card .terminal-bar { padding: 12px 16px; }

.login-body { padding: 32px 28px 30px; }

.login-lock {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.login-title {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 26px;
}

.login-form label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.login-form input {
  width: 100%;
  background: var(--bg-void);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 13px 14px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
  margin-bottom: 18px;
}
.login-form input:focus { outline: none; border-color: var(--accent-cyan); }

.login-form .btn { width: 100%; justify-content: center; border: none; }

.login-error {
  color: #ff6b6b;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin-top: 14px;
  min-height: 1.2em;
}

.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.login-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.login-back:hover { color: var(--accent-cyan); }

/* =========================================================================
   DASHBOARD
   ========================================================================= */
.dash-shell { min-height: 100vh; }

.dash-topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,14,20,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.dash-topbar .brand { font-family: var(--font-mono); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.dash-topbar .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-cyan); box-shadow: 0 0 10px var(--accent-cyan); }
.dash-actions { display: flex; gap: 10px; align-items: center; }
.dash-actions .btn { padding: 9px 16px; font-size: 0.78rem; }
.btn-danger { border: 1px solid rgba(255,107,107,0.4); color: #ff6b6b; background: rgba(255,107,107,0.06); }
.btn-danger:hover { border-color: #ff6b6b; }

.status-banner {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
}
.status-banner.status-error {
  background: rgba(255,107,107,0.08);
  color: #ff8f8f;
  border-bottom-color: rgba(255,107,107,0.3);
}
.status-banner.status-warn {
  background: rgba(255,180,84,0.08);
  color: #ffb454;
  border-bottom-color: rgba(255,180,84,0.3);
}
.status-banner.status-ok {
  background: rgba(0,229,199,0.06);
  color: var(--accent-cyan);
  border-bottom-color: rgba(0,229,199,0.25);
}
.status-banner a { color: inherit; text-decoration: underline; }
.status-banner .status-recheck {
  margin-left: auto;
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0.85;
}
.status-banner .status-recheck:hover { opacity: 1; }

.dash-body {
  display: grid;
  grid-template-columns: 210px 1fr;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  gap: 32px;
}
@media (max-width: 780px) { .dash-body { grid-template-columns: 1fr; } }

.dash-tabs { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 84px; align-self: start; }
@media (max-width: 780px) { .dash-tabs { flex-direction: row; overflow-x: auto; position: static; } }
.dash-tab {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: left;
  padding: 11px 14px;
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.dash-tab:hover { color: var(--text-primary); background: var(--bg-panel); }
.dash-tab.active { color: var(--accent-cyan); background: var(--bg-panel); border-color: var(--border-soft); }

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

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { font-family: var(--font-mono); font-size: 1.2rem; }
.panel-hint { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 24px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.field-grid.single { grid-template-columns: 1fr; }
@media (max-width: 600px) { .field-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent-cyan); text-transform: uppercase; letter-spacing: 0.05em; }
.field input, .field textarea, .field select {
  background: var(--bg-void);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 11px 13px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent-cyan); }
.field-check { flex-direction: row; align-items: center; gap: 8px; }
.field-check input { width: auto; }

.field input[type="file"] {
  padding: 9px 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.field input[type="file"]::file-selector-button {
  background: var(--accent-cyan);
  color: #06110f;
  border: none;
  border-radius: 5px;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  margin-right: 10px;
  cursor: pointer;
}

.entry-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.entry-head .tag { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.entry-remove {
  background: none; border: 1px solid var(--border-soft); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.72rem; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  transition: all 0.2s ease;
}
.entry-remove:hover { color: #ff6b6b; border-color: #ff6b6b; }

.btn-add {
  background: none;
  border: 1px dashed var(--border-soft);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 13px;
  width: 100%;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}
.btn-add:hover { border-color: var(--accent-cyan); background: rgba(0,229,199,0.05); }

.cert-thumb-preview {
  width: 100%; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden;
  background: var(--bg-panel-2); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); margin-bottom: 12px;
}
.cert-thumb-preview img { width: 100%; height: 100%; object-fit: cover; }

.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel);
  border: 1px solid var(--accent-cyan);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 12px 22px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* =========================================================================
   ADMIN MOBILE RESPONSIVE
   ========================================================================= */

/* Tablets and small laptops */
@media (max-width: 780px) {

  .dash-topbar {
    height: auto;
    min-height: 60px;
    padding: 10px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .dash-topbar .brand {
    font-size: 0.82rem;
  }

  .dash-actions {
    flex-wrap: wrap;
  }

  .dash-body {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    padding: 20px 16px 60px;
    gap: 18px;
  }

  .dash-tabs {
    position: static;
    display: flex;
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .dash-tab {
    flex: 0 0 auto;
    font-size: 0.72rem;
    padding: 9px 12px;
    text-align: center;
  }

  .dash-content {
    width: 100%;
    min-width: 0;
  }

  .dash-panel {
    width: 100%;
    min-width: 0;
  }

  .panel-head {
    align-items: flex-start;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}


/* Phones */
@media (max-width: 600px) {

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    -webkit-text-size-adjust: 100%;
  }

  /* =========================
     LOGIN PAGE
     ========================= */

  body.admin-body {
    min-height: 100dvh;
    padding: 12px;
    align-items: center;
    justify-content: center;
  }

  .login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 10px;
  }

  .login-card .terminal-bar {
    padding: 10px 12px;
  }

  .login-body {
    padding: 24px 18px 22px;
  }

  .login-lock {
    font-size: 0.68rem;
  }

  .login-title {
    font-size: 1.15rem;
  }

  .login-sub {
    font-size: 0.78rem;
    line-height: 1.5;
    margin-bottom: 22px;
  }

  .login-form label {
    font-size: 0.68rem;
  }

  .login-form input {
    width: 100%;
    min-height: 46px;
    font-size: 16px;
    padding: 12px;
  }

  .login-form .btn {
    width: 100%;
    min-height: 46px;
  }

  .login-error {
    font-size: 0.7rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .login-back {
    font-size: 0.7rem;
  }


  /* =========================
     DASHBOARD TOP BAR
     ========================= */

  .dash-topbar {
    width: 100%;
    padding: 10px 12px;
    min-height: auto;
    gap: 10px;
    align-items: stretch;
  }

  .dash-topbar .brand {
    width: 100%;
    min-width: 0;
    font-size: 0.72rem;
    line-height: 1.4;
  }

  .dash-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .dash-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 5px;
    font-size: 0.64rem;
    white-space: normal;
    line-height: 1.2;
  }


  /* =========================
     DASHBOARD CONTENT
     ========================= */

  .dash-body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 16px 12px 60px;
    gap: 16px;
  }

  .dash-tabs {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 2px 2px 8px;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .dash-tabs::-webkit-scrollbar {
    height: 4px;
  }

  .dash-tab {
    flex: 0 0 auto;
    font-size: 0.65rem;
    padding: 9px 11px;
    min-height: 36px;
  }

  .dash-content {
    width: 100%;
    min-width: 0;
  }


  /* =========================
     PANEL HEADERS
     ========================= */

  .panel-head {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 18px;
  }

  .panel-head h2 {
    font-size: 1rem;
  }

  .panel-head .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  .panel-hint {
    font-size: 0.72rem;
    line-height: 1.5;
    margin-bottom: 18px;
  }


  /* =========================
     FORMS
     ========================= */

  .field-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 13px;
    margin-bottom: 13px;
  }

  .field-grid.single {
    grid-template-columns: 1fr;
  }

  .field {
    width: 100%;
    min-width: 0;
  }

  .field label {
    font-size: 0.65rem;
  }

  .field input,
  .field textarea,
  .field select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 16px;
    padding: 11px 12px;
  }

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

  .field input[type="file"] {
    width: 100%;
    max-width: 100%;
    font-size: 0.68rem;
    padding: 8px;
    overflow: hidden;
  }

  .field input[type="file"]::file-selector-button {
    max-width: 100%;
    margin-right: 6px;
    padding: 7px 9px;
    font-size: 0.65rem;
  }


  /* =========================
     ENTRY CARDS
     ========================= */

  .entry-card {
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    margin-bottom: 12px;
    overflow: hidden;
  }

  .entry-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    margin-bottom: 13px;
  }

  .entry-head .tag {
    font-size: 0.63rem;
    overflow-wrap: anywhere;
  }

  .entry-remove {
    width: 100%;
    min-height: 36px;
    font-size: 0.68rem;
  }

  .btn-add {
    width: 100%;
    min-height: 44px;
    font-size: 0.7rem;
  }


  /* =========================
     PROFILE PHOTO PREVIEW
     ========================= */

  .cert-thumb-preview {
    max-width: 130px !important;
    width: 130px;
    height: 130px;
  }


  /* =========================
     CHECKBOXES
     ========================= */

  .field-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .field-check input {
    width: 18px;
    min-width: 18px;
  }


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

  .toast {
    left: 10px;
    right: 10px;
    bottom: 12px;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    transform: translateY(20px);
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.4;
    padding: 10px 12px;
  }

  .toast.show {
    transform: translateY(0);
  }
}


/* Very small phones: 320px–380px */
@media (max-width: 380px) {

  .dash-topbar {
    padding: 8px;
  }

  .dash-actions {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .dash-actions .btn {
    font-size: 0.58rem;
    padding: 7px 4px;
  }

  .dash-body {
    padding-left: 8px;
    padding-right: 8px;
  }

  .dash-tab {
    font-size: 0.6rem;
    padding: 8px 9px;
  }

  .entry-card {
    padding: 11px;
  }

  .login-body {
    padding: 20px 14px;
  }

  .login-title {
    font-size: 1.05rem;
  }
}