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

/* Custom navbar styling */
.navbar {
  padding: 0.25rem 1rem !important;
  min-height: 2.5rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar .navbar-brand {
  font-size: 1.1rem;
  font-weight: 600;
  margin-right: auto;
}

.navbar .navbar-brand i {
  font-size: 1rem;
}

/* Info link styling */
.info-link {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

.info-link:hover {
  color: rgba(255, 255, 255, 1);
  text-decoration: none;
}

.navbar .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-width: 1px;
  transition: all 0.2s ease-in-out;
}

.navbar .btn:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Load buttons styling - more subtle white */
.navbar label.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.navbar label.btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.7);
  color: rgba(255, 255, 255, 0.85);
}

.navbar label[for="files-input"] {
  border-color: #17a2b8;
  color: #17a2b8;
  cursor: pointer;
  height: calc(2.2em);
  align-items: center;
  justify-content: center;
}

.navbar label[for="files-input"]:hover {
  background-color: #17a2b8;
  border-color: #17a2b8;
  color: white;
}

/* Shortcuts button styling */
.navbar #shortcuts-btn {
  height: calc(2.2em);
  align-items: center;
  justify-content: center;
  color: #aeacac;
  border-color: #7d7a7a;
}

/* Save button styling - more vibrant green */
.navbar #save-notes-btn {
  border-color: #28a745;
  color: #28a745;
}

.navbar #save-notes-btn:hover {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

/* Close button styling - more vibrant red */
.navbar #close-btn {
  border-color: #dc3545;
  color: #dc3545;
}

.navbar #close-btn:hover {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

.navbar input[type="file"] {
  display: none;
}

.main-content-row {
  height: calc(100vh - 2.5rem);
}

/* Layout sections */
.pdf-section {
  border-right: 0.125rem solid #dee2e6;
  height: calc(100vh - 2.5rem);
}

.notes-section {
  background-color: #f8f9fa;
  height: calc(100vh - 2.5rem);
}

#load-notes-input {
  display: none;
}

/* PDF Container */
.pdf-container {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #f5f5f5;
}

.pdf-controls {
  position: absolute;
  bottom: 0.625rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  color: white;
  white-space: nowrap;
  box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdf-controls button {
  margin: 0;
  min-width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-controls button.active {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.pdf-controls .btn-outline-warning.active {
  background-color: rgba(255, 193, 7, 0.3);
  border-color: #ffc107;
  color: #fffb07;
}

.pdf-controls .btn-outline-danger.active {
  background-color: rgba(220, 53, 69, 0.3);
  border-color: #dc3545;
  color: #ff6b6b;
}

.zoom-info {
  height: 2rem;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.pdf-controls span {
  margin: 0;
  color: white;
  font-size: 0.875rem;
}

.page-navigation {
  display: inline-flex;
  align-items: center;
  margin: 0;
  height: 2rem;
}

.page-input-field {
  width: 3rem;
  height: 1.75rem;
  padding: 0.125rem 0.375rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.3);
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-align: center;
  font-size: 0.875rem;
  outline: none;
  margin: 0 0.25rem;
}

.page-input-field:focus {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.2);
}

.page-input-field::-webkit-outer-spin-button,
.page-input-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-input-field[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.page-total {
  color: white;
  font-size: 0.875rem;
  margin-left: 0.25rem;
}

.zoom-clickable {
  cursor: pointer;
  user-select: none;
  padding: 0.125rem 0.25rem;
  border-radius: 0.1875rem;
  transition: background-color 0.2s ease;
}

.zoom-clickable:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #525659;
  cursor: grab;
}

.pdf-viewer.panning {
  cursor: grabbing;
}

.pdf-canvas-container {
  position: relative;
  margin: 20px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

#pdf-canvas {
  display: block;
  border: 1px solid #000;
}

/* Text layer for text selection */
.textLayer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.2;
  line-height: 1;
}

.textLayer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}

.textLayer .highlight {
  margin: -1px;
  padding: 1px;
  background-color: rgba(180, 0, 170, 1);
  border-radius: 4px;
}

.textLayer .highlight.begin {
  border-radius: 4px 0px 0px 4px;
}

.textLayer .highlight.end {
  border-radius: 0px 4px 4px 0px;
}

.textLayer .highlight.middle {
  border-radius: 0px;
}

.textLayer .highlight.selected {
  background-color: rgba(0, 100, 0, 1);
}

/* Custom highlights */
.textLayer .user-highlight {
  background-color: rgba(255, 255, 0, 1) !important;
  border-radius: 2px;
}

.textLayer .user-highlight:hover {
  background-color: rgba(255, 255, 0, 0.9) !important;
}

.pdf-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  overflow: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.pdf-canvas {
  max-width: none; /* Allow canvas to exceed container when zoomed */
  max-height: none; /* Allow canvas to exceed container when zoomed */
  width: auto;
  height: auto;
  display: block;
  box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.15);
  background-color: #f5f5f5;
  border-radius: 0.25rem;
  margin: auto; /* Center the canvas when smaller than container */
}

.pdf-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.pdf-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: none;
}

.pdf-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.25rem 0.75rem;
  backdrop-filter: blur(0.3125rem);
  z-index: 10;
  border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.1);
}

.pdf-controls-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 0.625rem;
}

.page-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.zoom-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.625em;
  text-align: center;
  padding: 0 0.5rem;
  line-height: 1;
}

.zoom-info {
  color: white;
  font-weight: 600;
  font-size: 0.75em;
  min-width: 2.625rem;
  height: 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 0 0.5rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-btn {
  min-width: 5rem;
  height: 2rem;
  font-size: 0.625em;
  font-weight: 600;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 0.25rem;
  white-space: nowrap;
}

.page-input-container {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: white;
  font-weight: 600;
  font-size: 0.875em;
  height: 2rem;
}

.page-label {
  color: white;
  font-weight: 600;
  font-size: 0.875em;
  line-height: 1;
}

.page-input {
  width: 3rem;
  height: 1.75rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-weight: 600;
  font-size: 0.875em;
  padding: 0 0.25rem;
  line-height: 1;
}

.page-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.page-input::-webkit-outer-spin-button,
.page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Notes Panel */
.notes-panel-height {
  height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
}

.notes-content-height {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  box-sizing: border-box;
}

.notes-header {
  border-bottom: 0.125rem solid #dee2e6;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.page-sync-indicator {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
}

.page-sync-indicator i {
  font-size: 1.125em;
}

.page-sync-indicator i.fa-sync-alt {
  color: #28a745;
}

.page-sync-indicator i.fa-exclamation-triangle {
  color: #ffc107;
}

.pdf-info {
  background-color: #e9ecef;
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
}

.notes-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.current-page-note {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#note-textarea {
  flex: 1;
  resize: none;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1em;
  line-height: 1.6;
  border: 0.125rem solid #ced4da;
  border-radius: 0.5rem;
  padding: 1.25rem;
  box-sizing: border-box;
  min-height: 18.75rem;
}

#note-textarea:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
  outline: none;
}

.markdown-preview {
  flex: 1;
  cursor: text;
  overflow-y: auto;
  white-space: normal;
  word-wrap: break-word;
  border: 0.125rem solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1.25rem;
  background-color: white;
  min-height: 18.75rem;
  max-height: calc(100vh - 10rem);
  box-sizing: border-box;
  font-size: 1em;
  line-height: 1.6;
}

.markdown-preview:hover {
  border-color: #0d6efd;
  transition: border-color 0.2s ease;
}

.markdown-preview em {
  color: #6c757d;
  font-style: italic;
}

/* Shortcuts Modal */
.shortcuts-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.shortcuts-modal.show {
  display: flex;
}

.shortcuts-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
}

.shortcuts-modal-content {
  position: relative;
  background: #2d3748;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shortcuts-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #4a5568;
  background: #1a202c;
  border-radius: 12px 12px 0 0;
}

.shortcuts-modal-header h5 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #e2e8f0;
}

.shortcuts-close-btn {
  background: none;
  border: none;
  color: #cbd5e0;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.shortcuts-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.shortcuts-modal-body {
  padding: 1.5rem;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcut-item:last-child {
  border-bottom: none;
}

.shortcut-section-title {
  padding: 1rem 0 0.5rem 0;
  color: #cbd5e0;
  font-size: 0.9rem;
}

.shortcut-section-title strong {
  color: #e2e8f0;
}

.shortcut-description {
  color: #e2e8f0;
  font-size: 0.95rem;
}

.shortcut-item kbd {
  background: #4a5568;
  color: #e2e8f0;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid #718096;
}

/* Toast notifications */

/* Responsive adjustments */
@media (max-width: 768px) {
  .pdf-overlay {
    padding: 0.1875rem 0.5rem;
  }

  .pdf-controls-container {
    flex-direction: row;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 0 0.3125rem;
  }

  .page-navigation {
    gap: 0.375rem;
    flex: 1;
    justify-content: center;
  }

  .zoom-controls {
    gap: 0.25rem;
  }

  .nav-btn {
    min-width: 4.0625rem;
    height: 1.75rem;
    font-size: 0.5625em;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 0.1875rem;
    white-space: nowrap;
  }

  .zoom-btn {
    width: 1.625rem;
    height: 1.625rem;
    font-size: 0.5625em;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 0.1875rem;
  }

  .page-input-container {
    font-size: 0.6875em;
    height: 1.75rem;
    gap: 0.25rem;
  }

  .page-input {
    width: 2.5rem;
    height: 1.5rem;
    font-size: 0.75em;
    padding: 0 0.125rem;
  }

  .page-label {
    font-size: 0.6875em;
  }

  .zoom-info {
    font-size: 0.625em;
    min-width: 2.375rem;
    height: 1.75rem;
    padding: 0 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 0.1875rem;
  }
}

/* Responsive navbar improvements */
@media (max-width: 768px) {
  .navbar {
    padding: 0.2rem 0.5rem !important;
    min-height: 2.25rem !important;
  }
  
  .navbar .navbar-brand {
    font-size: 1rem;
  }
  
  .navbar .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
  }
  
  .main-content-row {
    height: calc(100vh - 2.25rem);
  }
}

@media (max-width: 576px) {
  .navbar {
    padding: 0.2rem !important;
  }
  
  .navbar .navbar-brand span {
    display: none;
  }
  
  .navbar .btn {
    padding: 0.15rem 0.3rem;
  }
}

/* Search Bar Styles */
.search-container {
  max-width: 400px;
}

@media (max-width: 575px) {
  .search-container {
    max-width: 250px;
  }
  
  .search-container input {
    font-size: 0.875rem;
    padding-right: 60px !important;
  }
  
  .search-buttons .btn {
    padding: 0.2rem 0.3rem !important;
    font-size: 0.7rem !important;
  }
}

.search-container input {
  background-color: #2d3748 !important;
  border-color: #4a5568 !important;
  color: #e2e8f0 !important;
}

.search-container input:focus {
  background-color: #374151 !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
  color: #f8fafc !important;
}

.search-container input::placeholder {
  color: #9ca3af !important;
}

.search-buttons .btn {
  padding: 0.25rem 0.4rem !important;
  font-size: 0.75rem !important;
  border-color: #6b7280 !important;
}

.search-buttons .btn:hover:not(:disabled) {
  background-color: #374151 !important;
  border-color: #9ca3af !important;
}

.search-buttons .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-info {
  font-size: 0.75rem !important;
  color: #9ca3af !important;
}

/* Search highlight styles */
.search-highlight {
  background-color: #fbbf24 !important;
  color: #000 !important;
  padding: 1px 2px;
  border-radius: 2px;
}

.search-highlight.current {
  background-color: #f59e0b !important;
  box-shadow: 0 0 3px rgba(245, 158, 11, 0.6);
}

/* Toast notification styles */
.toast-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #2d3748;
  color: #e2e8f0;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease-in-out;
  border-left: 4px solid #48bb78;
  max-width: 400px;
  word-wrap: break-word;
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}
