/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Local theme + component CSS (relative to /lib/css/style.css) */
@import url('./themes/themes.css');
@import url('./page/button.css');
@import url('./page/input-panel-buttons.css');
@import url('./page/layout.css');
@import url('./page/panel.css');
@import url('./page/quotes.css');

/* --------------------------------------------------
   SNQR Research Reader – base layout
-------------------------------------------------- */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top left, #1f2937 0, #020617 45%, #000000 100%);
  color: #e5e7eb;
  /* allow natural scrolling; zoom handler will lock when needed */
  overflow: auto;
}

/* Flipbook container – responsive:
   - mobile/tablet: relative, full width, 100vh height
   - desktop: fixed full-screen overlay
*/
#flipbookContainer {
  position: relative;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  background: radial-gradient(circle at top, #111827 0, #020617 60%);
  z-index: 1;
}

body.panel-open {
  overflow-y: auto;
}

/* Desktop / large screens: lock as full-screen fixed */
@media (min-width: 1024px) {
  #flipbookContainer {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
  }
}

/* --------------------------------------------------
   Unified Control Panel
-------------------------------------------------- */

.unified-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 360px;
  height: 100vh;
  background: rgba(15, 23, 42, 0.97);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  border-left: 1px solid rgba(148, 163, 184, 0.3);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease-out, opacity 0.25s ease-out, transform 0.25s ease-out;
  opacity: 0;
  transform: translateX(6px);
}

.unified-panel.open {
  right: 0;
  opacity: 1;
  transform: translateX(0);
}

.unified-panel.panel-enhanced {
  border-left-color: rgba(96, 165, 250, 0.6);
}

.panel-header {
  padding: 16px 20px 12px 20px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-title {
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.panel-subtitle {
  font-size: 11px;
  color: #9ca3af;
}

.panel-close-btn {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.panel-close-btn:hover {
  background: rgba(30, 64, 175, 0.9);
  border-color: rgba(129, 140, 248, 0.8);
  transform: translateY(-1px);
}

/* Scrollable content */
.panel-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 18px 18px 18px;
}

/* Sections */
.panel-section {
  margin-bottom: 18px;
  padding: 10px 12px 12px 12px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.9),
    rgba(15, 23, 42, 0.96)
  );
  border: 1px solid rgba(31, 41, 55, 0.85);
}

.panel-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 10px;
}

.panel-section-title i {
  font-size: 13px;
  color: #60a5fa;
}

/* Groups */
.panel-group {
  margin-bottom: 10px;
}

.panel-group:last-child {
  margin-bottom: 0;
}

.panel-group-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.panel-group-label {
  font-size: 12px;
  font-weight: 500;
  color: #e5e7eb;
}

.panel-group-description {
  font-size: 11px;
  color: #94a3b8;
}

.panel-group-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Selects */
.panel-select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top left, #020617, #020617);
  color: #e5e7eb;
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.panel-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
}

/* Density toggles */
.panel-toggle-group {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.panel-toggle-btn {
  border: none;
  border-radius: 999px;
  font-size: 11px;
  padding: 4px 9px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.panel-toggle-btn.active {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #f9fafb;
}

.panel-toggle-btn:hover {
  transform: translateY(-0.5px);
}

/* Info badges */
.panel-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px dashed rgba(75, 85, 99, 0.9);
}

.panel-info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
}

.panel-info-value {
  font-size: 12px;
  color: #e5e7eb;
}

/* PDF tools & inputs (kept for future, though upload is disabled in HTML) */
.pdf-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.tool-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-label {
  font-size: 12px;
  color: #e5e7eb;
}

.pdf-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
}

.panel-input {
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top left, #020617, #020617);
  color: #e5e7eb;
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel-input::placeholder {
  color: #64748b;
}

.panel-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
}

/* Buttons */
.panel-button {
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.95);
  background: radial-gradient(circle at top left, #020617, #020617);
  color: #e5e7eb;
  font-size: 12px;
  padding: 6px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.panel-button i {
  font-size: 13px;
}

.panel-button:hover {
  background: radial-gradient(circle at top left, #0b1120, #020617);
  border-color: #60a5fa;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.direction-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
}

/* Top toggle button (outside panel) */
#toggleUnifiedPanelBtn {
  position: relative;
  z-index: 50;
}

/* --------------------------------------------------
   Density attribute on body
-------------------------------------------------- */

body[data-density="comfortable"] .unified-panel {
  font-size: 12px;
}

body[data-density="cozy"] .unified-panel {
  font-size: 11px;
}

body[data-density="compact"] .unified-panel {
  font-size: 10px;
}

/* --------------------------------------------------
   Small screen adjustments
-------------------------------------------------- */

@media (max-width: 768px) {
  .unified-panel {
    width: 100%;
    right: -100%;
  }

  .unified-panel.open {
    right: 0;
  }

  .panel-header {
    padding: 14px 16px 10px 16px;
  }

  .panel-content {
    padding: 12px 14px 16px 14px;
  }
}
