:root {
  --bg: #0b0e14;
  --bg-elev: #141821;
  --bg-elev-2: #1a1f2b;
  --border: #232936;
  --border-strong: #2e3548;
  --text: #e6e8ee;
  --text-dim: #9aa0b0;
  --text-mute: #6b7180;
  --accent: #00A8E0;
  --accent-2: #00C8FF;
  --accent-soft: rgba(0, 168, 224, 0.12);
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
  --radius: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
button {
  font-family: inherit;
  cursor: pointer;
}

/* ====== AUTH PAGE ====== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1000px 500px at 50% -10%, rgba(0,168,224,0.12), transparent),
    var(--bg);
  padding: 24px;
}
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
}
.auth-wp-logo {
  width: 220px;
  height: auto;
  margin-bottom: 28px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 24px 28px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-text {
  font-size: 0.7rem;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.footer-logo {
  height: 26px;
  width: auto;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.footer-logo:hover { opacity: 1; }
.auth-card h1 {
  margin: 0 0 6px 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-card .muted { color: var(--text-dim); margin: 0 0 24px; font-size: 0.9rem; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-card button {
  background: var(--accent);
  color: #001827;
  border: none;
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.15s;
}
.auth-card button:hover { background: var(--accent-2); }
.auth-card .small { display: block; margin-top: 18px; font-size: 0.78rem; }
.error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* ====== TOPBAR ====== */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.topbar.admin { border-bottom-color: var(--accent); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 0.98rem; font-weight: 700; }
.brand-text span { font-size: 0.7rem; color: var(--text-dim); letter-spacing: 0.04em; text-transform: uppercase; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: capitalize;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: var(--bg-elev-2); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent-2); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.link {
  background: none; border: none; padding: 0;
  color: var(--text-dim); font-size: 0.85rem; cursor: pointer;
  transition: color 0.15s;
}
.link:hover { color: var(--accent-2); }
.inline-form { display: inline; }

/* ====== CONTENT ====== */
.content { max-width: 1400px; margin: 0 auto; padding: 28px; }
.content h2, .content h3 {
  margin: 0 0 18px 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.content h2 { font-size: 1.5rem; }
.content h3 { font-size: 1.1rem; }
.count {
  font-size: 0.7rem;
  color: var(--text-mute);
  font-weight: 500;
  background: var(--bg-elev-2);
  padding: 2px 8px;
  border-radius: 999px;
}
.muted { color: var(--text-dim); }
.small { font-size: 0.78rem; }
.empty {
  background: var(--bg-elev);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty.small { padding: 18px; font-size: 0.85rem; }

/* ====== PHOTO GRID ====== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.photo-card {
  aspect-ratio: 1;
  background: var(--bg-elev);
  border-radius: 8px;
  overflow: hidden;
  cursor: zoom-in;
  position: relative;
  transition: transform 0.18s;
}
.photo-card:hover { transform: scale(1.015); }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ====== LIGHTBOX ====== */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(5,7,11,0.95);
  z-index: 100;
  display: grid; place-items: center;
}
.lightbox.hidden { display: none; }
.lightbox-inner {
  position: relative;
  width: 100%; height: 100%;
  display: grid; place-items: center;
}
#lb-img { max-width: 92vw; max-height: 88vh; box-shadow: var(--shadow); border-radius: 4px; }
.lb-close {
  position: absolute;
  top: 20px; right: 20px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
  font-size: 1.5rem;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lb-close:hover { background: rgba(255,255,255,0.22); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 168, 224, 0.18);
  border: 2px solid rgba(0, 200, 255, 0.55);
  color: #fff;
  font-size: 2.6rem;
  font-weight: 300;
  line-height: 1;
  padding-bottom: 6px;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 168, 224, 0.35);
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  z-index: 2;
}
.lb-nav:hover {
  background: rgba(0, 168, 224, 0.45);
  border-color: var(--accent-2);
  box-shadow: 0 0 36px rgba(0, 200, 255, 0.6);
  transform: translateY(-50%) scale(1.08);
}
.lb-prev { left: 28px; }
.lb-next { right: 28px; }
@media (max-width: 720px) {
  .lb-nav { width: 52px; height: 52px; font-size: 2.2rem; }
  .lb-prev { left: 12px; }
  .lb-next { right: 12px; }
}
.lb-bar {
  position: absolute;
  bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(20,24,33,0.92);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 14px;
  max-width: 80vw;
}
.lb-bar #lb-name {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

/* ====== VIDEOS ====== */
.vid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}
.vid-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.vid-card video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16/9;
  object-fit: contain;
}
.vid-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; gap: 12px;
}
.vid-name { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ====== DOCUMENTS ====== */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: border-color 0.15s;
}
.doc-item:hover { border-color: var(--border-strong); }
.doc-icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent-2);
  flex-shrink: 0;
}
.doc-pdf  { background: rgba(239,68,68,0.12); color: #fca5a5; }
.doc-doc, .doc-docx { background: rgba(59,130,246,0.12); color: #93c5fd; }
.doc-txt, .doc-md { background: rgba(168,85,247,0.12); color: #c4b5fd; }
.doc-name { flex: 1; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-size { color: var(--text-dim); font-size: 0.78rem; min-width: 70px; text-align: right; }
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 7px;
  background: var(--accent);
  color: #001827;
  font-weight: 600;
  font-size: 0.82rem;
  border: none;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-2); color: #001827; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
.btn.ghost:hover { background: var(--bg-elev-2); color: var(--text); }
.dl-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: 1px solid transparent;
}
.dl-btn:hover { background: var(--accent); color: #001827; }

/* ====== DOC VIEWER ====== */
.doc-view-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.doc-view-bar strong { flex: 1; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-body {
  background: #fff;
  color: #1a1a1a;
  border-radius: var(--radius);
  padding: 40px 56px;
  line-height: 1.65;
  font-size: 0.95rem;
  min-height: 60vh;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.docx-body p { margin: 0 0 12px 0; }
.docx-body h1, .docx-body h2, .docx-body h3 { margin: 24px 0 12px 0; }
.docx-body table { border-collapse: collapse; }
.docx-body td, .docx-body th { border: 1px solid #ddd; padding: 6px 10px; }
.docx-body img { max-width: 100%; height: auto; }
.text-body {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ====== ADMIN ====== */
.admin-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
}
.upload-form {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.upload-form input[type=file] {
  flex: 1;
  min-width: 200px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: inherit;
}
.upload-form input[type=file]::file-selector-button {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  margin-right: 12px;
}
.upload-form button {
  background: var(--accent);
  color: #001827;
  border: none;
  padding: 8px 16px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.upload-form button:hover:not(:disabled) { background: var(--accent-2); }
.upload-form button:disabled { opacity: 0.6; cursor: not-allowed; }
.upload-status { color: var(--text-dim); font-size: 0.82rem; }

.admin-files { display: flex; flex-direction: column; gap: 6px; }
.admin-file {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
}
.admin-thumb {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-elev-2);
}
.admin-thumb.stub {
  display: inline-grid; place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.af-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.af-meta span { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-meta small { font-size: 0.7rem; color: var(--text-dim); }
.del-btn {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s;
}
.del-btn:hover { background: rgba(239,68,68,0.15); border-color: var(--danger); }
.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-badge.processing {
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
  animation: pulse 1.6s ease-in-out infinite;
}
.status-badge.failed {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.audit-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}
.audit-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.audit-table tr:last-child td { border-bottom: none; }
.action-login        { color: #6ee7b7; }
.action-login_fail   { color: #fca5a5; }
.action-logout       { color: var(--text-dim); }
.action-view_file    { color: #93c5fd; }
.action-download_file{ color: #c4b5fd; }
.action-upload       { color: var(--accent-2); }
.action-delete       { color: #fca5a5; }

/* ====== RESPONSIVE ====== */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; gap: 14px; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .content { padding: 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; }
  .vid-grid { grid-template-columns: 1fr; }
  .doc-body { padding: 24px 20px; }
  .doc-item { flex-wrap: wrap; }
  .doc-name { flex: 1 0 100%; order: -1; }
}
