:root {
  --bg: #0f1218;
  --panel: rgba(17, 20, 26, 0.96);
  --panel-soft: rgba(25, 29, 36, 0.94);
  --text: #f4efe8;
  --muted: #c3b9b2;
  --accent: #e6b26a;
  --accent-strong: #d58a47;
  --success: #8ae6a0;
  --error: #ff8c8c;
  --shadow: rgba(0, 0, 0, 0.38);
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top, #1d2430 0%, #0f1218 45%, #090b0f 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(12, 14, 18, 0.88), rgba(25, 30, 35, 0.8)),
    radial-gradient(circle at top left, rgba(230, 178, 106, 0.2), transparent 35%),
    radial-gradient(circle at bottom right, rgba(213, 138, 71, 0.18), transparent 30%);
  padding: 20px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-card {
  background: rgba(17, 21, 28, 0.9);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 28px 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
}

.login-header {
  margin-bottom: 18px;
}

.login-tag {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(230, 178, 106, 0.12);
  border: 1px solid rgba(230, 178, 106, 0.2);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 14px 0 0;
  font-size: clamp(2rem, 8vw, 2.5rem);
}

.login-subtitle {
  color: var(--muted);
  margin: 10px 0 22px;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  font-weight: 700;
  color: var(--text);
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrap input:focus {
  border-color: rgba(230, 178, 106, 0.9);
  box-shadow: 0 0 0 4px rgba(230, 178, 106, 0.12);
}

.login-form button {
  margin-top: 8px;
  width: 100%;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a120d;
  padding: 15px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.login-form button:hover {
  transform: translateY(-1px);
}

.message {
  min-height: 24px;
  margin-top: 18px;
  font-weight: 700;
  color: var(--text);
}

.message.success { color: var(--success); }
.message.error { color: var(--error); }

.admin-body {
  position: relative;
  min-height: 100vh;
  padding: 42px 22px;
  background: linear-gradient(180deg, rgba(7, 8, 12, 0.92), rgba(18, 22, 29, 0.95));
  overflow-x: hidden;
}

.admin-backdrop {
  position: absolute;
  inset: -20% -10% auto auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 178, 106, 0.22), rgba(230, 178, 106, 0.02) 55%, transparent 70%);
  filter: blur(8px);
}

.admin-shell,
.viewer-shell {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
}

.admin-header,
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 3vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.admin-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 24px;
}

.panel {
  background: linear-gradient(180deg, rgba(20, 24, 30, 0.95), rgba(14, 18, 24, 0.98));
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 28px 60px var(--shadow);
  padding: 22px;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(230, 178, 106, 0.12);
  border: 1px solid rgba(230, 178, 106, 0.3);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-label {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.panel-text {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 24px;
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 18px;
  border: 1.5px dashed rgba(230, 178, 106, 0.45);
  background: rgba(230, 178, 106, 0.04);
  border-radius: 18px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.upload-box:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 178, 106, 0.8);
}

.upload-icon {
  font-size: 1.5rem;
}

#fileInput {
  display: none;
}

.primary-btn,
.ghost-btn {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  width: 100%;
  margin-top: 20px;
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a120d;
  font-weight: 800;
  box-shadow: 0 16px 25px rgba(214, 131, 68, 0.32);
}

.ghost-btn {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(138, 230, 160, 0.12);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
}

.live-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 12px rgba(138, 230, 160, 0.8);
}

.preview-container,
.viewer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 620px;
  background: linear-gradient(180deg, rgba(39, 44, 54, 0.9), rgba(20, 25, 31, 0.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  -webkit-overflow-scrolling: touch;
}

.preview-container img,
.viewer-container img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 18px;
}

.preview-container iframe,
.viewer-container iframe {
  width: 100%;
  min-height: 620px;
  height: min(78vh, 900px);
  border: none;
  background: #fff;
  aspect-ratio: 16 / 9;
}

.empty-state {
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: 28px;
}

.viewer-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  background: radial-gradient(circle at top, rgba(43, 29, 18, 0.9), rgba(13, 16, 21, 0.92));
}

.viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(0.5);
  transform: scale(1.12);
  opacity: 1;
}

.viewer-backdrop iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  opacity: 0.8;
  filter: blur(16px) brightness(0.5);
}

.viewer-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1100px);
}

.viewer-header {
  justify-content: center;
  text-align: center;
  margin-bottom: 16px;
  color: #fff;
}

.viewer-container {
  min-height: 76vh;
  width: 100%;
  background: rgba(10, 12, 16, 0.52);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

.no-pdf {
  max-width: 620px;
  margin: 80px auto;
  padding: 32px 24px;
  text-align: center;
  background: rgba(18, 22, 29, 0.76);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  box-shadow: 0 18px 40px var(--shadow);
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .preview-container,
  .viewer-container {
    min-height: 58vh;
    height: auto;
  }

  .preview-container iframe,
  .viewer-container iframe {
    min-height: 58vh;
    height: min(58vh, 700px);
    aspect-ratio: 16 / 9;
  }

  .preview-container img,
  .viewer-container img {
    max-height: 68vh;
    width: 100%;
    object-fit: contain;
  }

  .login-card {
    padding: 24px 18px;
  }

  .viewer-shell {
    width: 100%;
  }

  .viewer-container {
    min-height: 68vh;
  }
}
