/* Global reset and styling definitions */
:root {
  --bg-color: #0b0b1a;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-color: #f5f5fa;
  --text-muted: #8c8ca5;
  --accent-gold: #e2b755;
  --accent-blue: #3d84f6;
  --accent-cyan: #00f2fe;
  --danger-color: #eb5757;
  --font-family: 'Poppins', 'Outfit', sans-serif;
  --glow-shadow: 0 0 25px rgba(226, 183, 85, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Ambient Background Stars & Nebulas */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 70px 110px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 120px 200px, #e2b755, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 250px 320px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 320px 450px, #3d84f6, rgba(0,0,0,0));
  background-size: 400px 400px;
  opacity: 0.25;
}

.nebula-1 {
  position: fixed;
  top: -30%;
  right: -10%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle, rgba(155, 81, 224, 0.12) 0%, rgba(0,0,0,0) 70%);
  z-index: -2;
  filter: blur(80px);
  pointer-events: none;
}

.nebula-2 {
  position: fixed;
  bottom: -20%;
  left: -20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(61, 132, 246, 0.1) 0%, rgba(0,0,0,0) 75%);
  z-index: -2;
  filter: blur(80px);
  pointer-events: none;
}

/* Layout container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Area */
.main-header {
  text-align: center;
  margin-bottom: 25px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sparkle {
  color: var(--accent-gold);
  font-size: 1.4rem;
  text-shadow: 0 0 10px var(--accent-gold);
}

.logo h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  background: rgba(226, 183, 85, 0.1);
  color: var(--accent-gold);
  border: 1px solid rgba(226, 183, 85, 0.2);
  padding: 3px 10px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 650px;
  margin: 0 auto;
}

/* Initial Upload State Card */
.upload-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed var(--panel-border);
  border-radius: 24px;
  padding: 60px 40px;
  backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;
  max-width: 800px;
  width: 100%;
  margin: 30px auto;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  transition: all 0.3s ease;
}

.upload-card:hover, .upload-card.dragover {
  border-color: var(--accent-gold);
  box-shadow: var(--glow-shadow);
  background: rgba(255, 255, 255, 0.04);
}

.upload-content {
  text-align: center;
  z-index: 2;
}

.upload-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  color: var(--accent-gold);
  opacity: 0.85;
}

.upload-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.upload-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 25px;
}

/* Primary buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 30px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  border: none;
  font-family: var(--font-family);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #c4993a 100%);
  color: #0b0b1a;
  box-shadow: var(--glow-shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(226, 183, 85, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: #eb4545;
}

.btn-block {
  display: flex;
  width: 100%;
  margin-bottom: 12px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
  border-radius: 6px;
}

.btn-icon-svg {
  width: 16px;
  height: 16px;
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 25px;
  flex: 1;
  margin-top: 15px;
  height: calc(100vh - 160px);
}

/* Pages Sidebar (Thumbnails) */
.pages-sidebar {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(15px);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.count-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pages-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

/* Thumbnails */
.thumbnail-item {
  width: 100%;
  aspect-ratio: 1 / 1.41;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumbnail-item canvas {
  width: 100% !important;
  height: auto !important;
}

.thumbnail-item:hover {
  border-color: var(--text-muted);
}

.thumbnail-item.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(226, 183, 85, 0.15);
}

.page-num-tag {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 500;
}

/* Editor View (Center Workspace) */
.editor-view {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(15px);
  overflow: hidden;
  position: relative;
}

.editor-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--panel-border);
}

.btn-icon {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

#zoom-indicator {
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 45px;
  text-align: center;
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--panel-border);
}

.canvas-container {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  background: rgba(0,0,0,0.15);
}

.canvas-wrapper {
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  background: #ffffff;
}

#pdf-canvas {
  display: block;
}

/* Redaction Overlay and Boxes */
.interaction-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 10;
}

.redaction-box {
  position: absolute;
  background: rgba(235, 87, 87, 0.35);
  border: 1.5px dashed var(--danger-color);
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.redaction-label {
  background: var(--danger-color);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Resize handle for custom boxes */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid var(--danger-color);
  bottom: -4px;
  right: -4px;
  cursor: se-resize;
  border-radius: 50%;
}

.delete-box-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: var(--danger-color);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.3);
}

.delete-box-btn:hover {
  background: #ff5252;
}

.editor-footer {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--panel-border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Settings Sidebar (Right) */
.settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
}

.settings-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(15px);
}

.settings-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.control-group {
  margin-bottom: 18px;
}

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

/* Custom switch sliders */
.switch-container {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  background-color: rgba(255,255,255,0.08);
  transition: .3s;
  border-radius: 34px;
  margin-right: 12px;
  border: 1px solid var(--panel-border);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

.switch-container input:checked + .switch-slider {
  background-color: rgba(226, 183, 85, 0.2);
  border-color: var(--accent-gold);
}

.switch-container input:checked + .switch-slider:before {
  transform: translateX(18px);
  background-color: var(--accent-gold);
}

.helper-text {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 4px;
  line-height: 1.4;
  padding-left: 50px;
}

/* TextInput Inputs */
.input-group {
  margin-bottom: 15px;
}

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

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s ease;
}

.input-group input:focus {
  border-color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.06);
}

.input-group .helper-text {
  padding-left: 0;
  margin-top: 3px;
}

/* Actions Card */
.actions-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(15px);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Compact layout for editing workspace to prevent vertical page scrolling */
body.workspace-active {
  overflow: hidden;
}

body.workspace-active .main-header {
  margin-bottom: 8px;
}

body.workspace-active .main-header .logo h1 {
  font-size: 1.6rem;
}

body.workspace-active .main-header .sparkle {
  font-size: 1.1rem;
}

body.workspace-active .main-header .tagline {
  display: none;
}

body.workspace-active .app-container {
  padding: 15px 20px 20px 20px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

body.workspace-active .workspace {
  margin-top: 5px;
  height: calc(100vh - 110px);
  overflow: hidden;
}

/* Document Page Cards Thumbnails */
.thumbnail-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 15px 10px;
}

.doc-graphic {
  width: 55px;
  height: 75px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--panel-border);
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.thumbnail-item:hover .doc-graphic {
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.thumbnail-item.active .doc-graphic {
  border-color: var(--accent-gold);
  background: rgba(226, 183, 85, 0.05);
  box-shadow: 0 0 15px rgba(226, 183, 85, 0.2);
}

.doc-page-num {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-family);
  transition: color 0.2s ease;
}

.thumbnail-item:hover .doc-page-num {
  color: var(--text-color);
}

.thumbnail-item.active .doc-page-num {
  color: var(--accent-gold);
}

.doc-pills {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  width: 100%;
}

.pill {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  user-select: none;
}

.pill-header {
  background: var(--accent-gold);
  color: #0b0b1a;
}

.pill-footer {
  background: #c4993a;
  color: #0b0b1a;
}

.pill-ad {
  background: var(--danger-color);
  color: #ffffff;
}

.pill-custom {
  background: var(--accent-blue);
  color: #ffffff;
}


