:root {
  --primary: #2563eb;
  --secondary: #64748b;
  --bg: #f8fafc;
  --text: #1e293b;
  --white: #ffffff;
  --danger: #ef4444;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* App Bar */
.app-bar {
  height: 60px;
  background-color: var(--white);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
}

.app-bar h1 {
  font-size: 1.25rem;
  margin: 0;
}

.app-bar-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.burger-menu {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text); /* Ensure visibility */
  margin-right: 0.5rem;
}

/* Layout container */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: #525659; /* Move background here */
}

/* Sidebar / List styles */
.sidebar {
  width: 300px;
  background-color: var(--white);
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease;
  z-index: 95;
}

.pdf-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem; /* Add padding to the container */
  margin: 0;
}

.pdf-item {
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdf-item:hover {
  background-color: #f1f5f9;
}

.pdf-item.active {
  background-color: #e0f2fe;
  color: var(--primary);
  font-weight: 500;
  box-shadow: inset 4px 0 0 var(--primary);
}

/* Viewer styles */
.viewer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto; /* Allow scrolling for multiple pages */
}

#pdf-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px;
  gap: 20px;
}

.pdf-page-canvas {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  max-width: 100%;
  height: auto !important; /* Maintain aspect ratio */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .burger-menu {
    display: block;
  }

  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .app-bar-actions .nav-links {
    display: none;
  }
}

.copy-link-btn {
  background-color: var(--secondary);
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}

.sidebar-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 85;
}

.sidebar-overlay.active {
  display: block;
}


#pdf-canvas {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  margin-bottom: 20px;
}

/* Admin Panel Styles */
.admin-login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  background-color: var(--bg);
}

.login-card {
  background: var(--white);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  width: 100%;
  max-width: 400px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  box-sizing: border-box;
}

button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:hover {
  opacity: 0.9;
}

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

button.secondary {
  background-color: var(--secondary);
}

.admin-dashboard {
  padding: 2rem;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  overflow-y: visible; /* Changed from auto to visible to let parent scroll if needed, or ensure it works */
}

/* Ensure the app container for admin allows scrolling */
#admin-app {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  margin-bottom: 2rem;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.document-table {
  width: 100%;
  border-collapse: collapse;
}

.document-table th, .document-table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reorder-btns button {
  padding: 2px 8px;
  font-size: 12px;
}

#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--primary);
}
