/* ===== admin.css ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:   #D4AF37;
  --gold2:  #F4D03F;
  --green:  #1B4332;
  --cream:  #FFF8E7;
  --navy:   #0D1B2A;
  --night1: #0a1628;
  --night2: #111f38;
  --card-bg: rgba(255,255,255,0.04);
  --border:  rgba(212,175,55,0.2);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--night1);
  color: var(--cream);
  min-height: 100vh;
  position: relative;
}

/* Background */
.admin-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 0%, #1a1233 0%, #0a1628 100%);
  z-index: 0;
  overflow: hidden;
}

.admin-stars { position: absolute; inset: 0; }

.star-dot {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle var(--dur, 3s) ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: var(--min, 0.15); }
  to   { opacity: 0.7; }
}

/* Container */
.admin-container {
  position: relative;
  z-index: 10;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* Header */
.admin-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.admin-logo {
  font-size: 2.5rem;
  animation: logoFloat 4s ease-in-out infinite alternate;
}

@keyframes logoFloat {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-8px) rotate(5deg); }
}

.admin-title {
  font-family: 'Amiri', serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--gold2);
  font-weight: 700;
}

.admin-subtitle {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Card */
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.section-title {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  color: var(--gold);
  margin-bottom: 20px;
  font-weight: 700;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.badge {
  background: rgba(212,175,55,0.15);
  color: var(--gold2);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Form */
.add-form { display: flex; flex-direction: column; gap: 18px; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input[type="text"] {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: white;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}

.form-group input::placeholder { color: rgba(255,255,255,0.25); }

.slug-preview {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0;
}

.slug-base { color: rgba(255,255,255,0.35); }
.slug-value { color: var(--gold2); font-weight: 600; }

.btn-add {
  background: linear-gradient(135deg, #c9a227, #e8d060, #c9a227);
  background-size: 200% 100%;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  color: #1a0a00;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  letter-spacing: 0.05em;
  align-self: flex-start;
  transition: background-position 0.4s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}

.btn-add:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,175,55,0.45);
}

.btn-add:active { transform: translateY(0); }

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: rgba(27,67,50,0.95);
  border: 1px solid rgba(45,106,79,0.6);
  color: #69e09c;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

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

/* Table */
.table-wrapper { overflow-x: auto; }

.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.card-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.card-table td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}

.card-table tr:last-child td { border-bottom: none; }
.card-table tr:hover td { background: rgba(255,255,255,0.03); }

.empty-row td {
  text-align: center;
  color: rgba(255,255,255,0.25);
  padding: 40px;
  font-style: italic;
}

.name-cell {
  font-weight: 600;
  color: var(--cream);
}

.link-cell a {
  color: var(--gold);
  text-decoration: none;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.link-cell a:hover { color: var(--gold2); text-decoration: underline; }

.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-copy, .btn-preview, .btn-delete {
  border: none;
  border-radius: 7px;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-copy {
  background: rgba(212,175,55,0.15);
  color: var(--gold2);
  border: 1px solid rgba(212,175,55,0.3);
}

.btn-copy:hover { background: rgba(212,175,55,0.25); transform: translateY(-1px); }

.btn-preview {
  background: rgba(45,106,79,0.2);
  color: #69e09c;
  border: 1px solid rgba(45,106,79,0.4);
}

.btn-preview:hover { background: rgba(45,106,79,0.35); transform: translateY(-1px); }

.btn-delete {
  background: rgba(180,30,30,0.15);
  color: #ff8080;
  border: 1px solid rgba(180,30,30,0.3);
}

.btn-delete:hover { background: rgba(180,30,30,0.3); transform: translateY(-1px); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  position: relative;
  width: 90%;
  max-width: 480px;
  height: 80vh;
  background: var(--night2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  animation: slideUp 0.3s cubic-bezier(.17,.67,.35,1.3);
}

@keyframes slideUp {
  from { transform: translateY(40px) scale(0.95); }
  to   { transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 10;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(255,255,255,0.2); }

#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
}

/* Footer */
.admin-footer {
  text-align: center;
  color: rgba(255,255,255,0.2);
  font-size: 0.78rem;
  padding-top: 20px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--night1); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ===== HIDDEN UTILITY ===== */
.hidden { display: none !important; }

/* ===== LOGOUT BUTTON ===== */
.btn-logout {
  margin-left: auto;
  background: rgba(180,30,30,0.12);
  border: 1px solid rgba(180,30,30,0.3);
  color: #ff8080;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-logout:hover { background: rgba(180,30,30,0.25); transform: translateY(-1px); }

/* ===== LOGIN OVERLAY ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, #1a1233 0%, #0a1628 100%);
}

.login-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  animation: slideUp 0.5s cubic-bezier(.17,.67,.35,1.3);
}

.login-logo {
  font-size: 3rem;
  text-align: center;
  display: block;
  margin-bottom: 16px;
  animation: logoFloat 4s ease-in-out infinite alternate;
}

.login-title {
  font-family: 'Amiri', serif;
  font-size: 1.5rem;
  color: var(--gold2);
  text-align: center;
  margin-bottom: 6px;
}

.login-sub {
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 28px;
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 7px;
  font-weight: 500;
}

.login-field input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: white;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }

.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
}

.login-error {
  background: rgba(180,30,30,0.15);
  border: 1px solid rgba(180,30,30,0.4);
  color: #ff8080;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, #c9a227, #e8d060, #c9a227);
  background-size: 200% 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  color: #1a0a00;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  letter-spacing: 0.05em;
  margin-top: 6px;
  transition: background-position 0.4s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}

.btn-login:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,175,55,0.45);
}

.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ===== ACTION BTN LOG ===== */
.btn-log {
  border: none;
  border-radius: 7px;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
  font-family: 'Inter', sans-serif;
  background: rgba(100,120,255,0.15);
  color: #a0b0ff;
  border: 1px solid rgba(100,120,255,0.3);
}
.btn-log:hover { background: rgba(100,120,255,0.28); transform: translateY(-1px); }

/* ===== VISIT BADGE ===== */
.visit-badge {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

.visit-badge.visited {
  background: rgba(45,106,79,0.2);
  color: #69e09c;
  border: 1px solid rgba(45,106,79,0.3);
}

.date-cell {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}

/* ===== LOGS MODAL ===== */
.modal-logs {
  max-width: 760px !important;
  height: 85vh !important;
  overflow-y: auto;
}

.logs-panel { padding: 28px; }

.logs-title {
  font-family: 'Amiri', serif;
  font-size: 1.25rem;
  color: var(--gold2);
  margin-bottom: 20px;
  margin-top: 8px;
  padding-right: 40px;
}

.logs-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  margin: 20px 0 12px;
}

.logs-loading {
  color: rgba(255,255,255,0.4);
  font-style: italic;
  padding: 20px 0;
}

.logs-empty {
  text-align: center;
  color: rgba(255,255,255,0.25);
  font-style: italic;
  padding: 40px 0;
}

/* Summary cards grid */
.logs-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

.log-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.log-card-icon { font-size: 1.5rem; margin-top: 2px; }

.log-card-body {
  flex: 1;
  min-width: 0;
}

.log-ip {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  color: var(--cream);
  font-weight: 600;
}

.log-device {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
}

.log-card-stats {
  text-align: right;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.log-count {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #69e09c;
}

.log-last, .log-first {
  display: block;
  color: rgba(255,255,255,0.35);
  font-size: 0.72rem;
  margin-top: 2px;
}

/* Logs table specifics */
.logs-table .ua-cell {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

