/* =========================================
   PROFESSIONAL TBOOK BUILDER INTERFACE
   ========================================= */

/* Global Reset and Base Styles */
html body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  min-height: 100vh;
  color: #4a5568;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  text-align: center;
  scroll-behavior: smooth;
  background: linear-gradient(135deg, #fafafb 0%, #d3e9fe 100%);
  color: #212529;
}

.chapter-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #4a5568;
  margin-bottom: 1rem;
}

/* Code and Pre Elements Styling for Editor */
code {
  font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 0.9em;
  background-color: #f4f4f4;
  color: #d63384;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #e0e0e0;
}

pre {
  font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-left: 4px solid #007bff;
  border-radius: 4px;
  padding: 12px 16px;
  margin: 10px 0;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background-color: transparent;
  border: none;
  padding: 0;
  color: #212529;
  font-size: 0.875rem;
}

blockquote {
  border-left: 4px solid #6c757d;
  padding-left: 16px;
  margin-left: 0;
  margin-right: 0;
  padding-top: 8px;
  padding-bottom: 8px;
  color: #6c757d;
  font-style: italic;
  position: relative;
}

blockquote::before {
  content: """;
  font-size: 3rem;
  line-height: 0;
  color: #6c757d;
  opacity: 0.3;
  position: absolute;
  left: -8px;
  top: 12px;
}

mark {
  background-color: #fff3cd;
  padding: 2px 4px;
  border-radius: 2px;
}

/* Text Alignment Utility Classes (used by editor alignment buttons) */
.text-left {
  text-align: left !important;
}

.text-center {
  text-align: center !important;
}

.text-right {
  text-align: right !important;
}

.text-justify {
  text-align: justify !important;
}

/*==================================
   BOOK_FORM.HTML BUILDER STYLES
   ============================== */
.notes {
  margin: 15px 0; 
  padding: 15px; 
  background-color: #e8f4fd; 
  border-left: 4px solid #007bff; 
  border-radius: 4px;
  font-size: 18px;
  line-height: 1.4;
}

.notes-big {
  margin-top: 10px;
  padding: .5rem 1rem .5rem 1rem;
  font-size: clamp(1.1rem, 1.5vw + 0.7rem, 1.5rem);
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  text-align: center;
}
.info-container {
  margin-top: 15px;
  margin-left: 3rem;
  margin-right: 3rem;
  padding: 12px;
  background-color: #c9e9ef;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  text-align: center;
  justify-content: center;
}
.text1 {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  padding: .5rem 1rem .5rem 1rem;
}
.text2 {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 20px 0;
}
.text3 {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 20px 0;
}
.enter-book-details {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  padding: .5rem 1rem .5rem 1rem;
}
.book-title {
  font-size: 2rem;
  text-align: center;
  padding: .5rem 1rem .5rem 1rem;
}
/* Form Section Containers */
.form-section {
  margin: 20px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

/* Form Inputs */
input[type="text"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  max-width: 600px;
  padding: 1rem;
  margin: 0.5rem auto 0 auto;
  border: 3px solid #93bbea;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  transition: all 0.3s ease;
  box-sizing: border-box;
  display: block;
}

/* Responsive form inputs */
@media (max-width: 767px) {
  input[type="text"],
  input[type="url"],
  input[type="file"],
  select,
  textarea {
    max-width: none;
    margin: 0.5rem 0 0 0;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  input[type="text"],
  input[type="url"],
  input[type="file"],
  select,
  textarea {
    max-width: 500px;
  }
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

input[type="text"]:hover,
input[type="url"]:hover,
select:hover,
textarea:hover {
  border-color: #5a6c7d;
}

/* Error highlight for validation */
input.error-highlight,
textarea.error-highlight,
select.error-highlight {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.2) !important;
  animation: shake 0.5s ease-in-out;
}

.selected-cover-file {
  display: none;
  margin: 10px 0;
  padding: 8px;
  background-color: #e8f4fd;
  border: 3px solid #93bbea !important;
  color: #007bff;
  font-size: 14px;
}
/* ==============================
   EXISTING CHAPTERS LIST STYLES
   (moved from book_chapter.html)
   Scoped to builder interface only
   ============================== */
.chapters-full-width {
  width: 100vw;
  max-width: none;
  margin-left: calc(-50vw + 50%);
  padding: 20px;
  background: rgba(248, 250, 252, 0.3);
}

.chapters-title {
  text-align: center;
  color: #2d3748;
  margin-bottom: 30px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(1.3rem, 2vw + 0.8rem, 2rem);
}

.chapters-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.chapter-row {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 2em;
  padding: 25px;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chapter-main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chapter-header-section {
  display: flex;
  gap: 20px;
  align-items: start;
}

.chapter-image-wrapper {
  flex: 0 0 200px;
  width: 200px;
}

.chapter-info-wrapper {
  margin: 0 0 8px 0; 
  color: #2d3748; 
  font-size: 20px;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.chapter-content-preview {
  background: rgba(248, 250, 252, 0.8);
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
  color: #2d3748;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.chapter-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: start;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
}

.reorder-controls {
  flex: 0 0 auto;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 20px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  min-width: 160px;
}

/* Style reorder buttons to match action buttons */
.reorder-controls button {
  background: linear-gradient(135deg, #fafafb 0%, #d3e9fe 100%);
  border-bottom: 2px solid #111;
  color: #333;
  backdrop-filter: blur(10px);
  padding: 0.8rem 1.5rem;
  text-decoration: none !important;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  margin: 0 5px;
  min-width: 45px;
}

.reorder-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.action-buttons {
  flex: 1;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Style action buttons to match fixed-buttons (sidebar) styling */
.action-buttons button {
  background: linear-gradient(135deg, #fafafb 0%, #d3e9fe 100%);
  border-bottom: 2px solid #111;
  color: #333;
  backdrop-filter: blur(10px);
  padding: 0.8rem 1.5rem;
  text-decoration: none !important;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
}

.action-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Mobile */
@media (max-width: 768px) {
  .chapters-full-width {
    padding: 15px;
  }
  .chapters-section {
    padding: 0 10px;
  }
  .chapter-row {
    padding: 20px;
    gap: 15px;
  }
  .chapter-header-section {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  .chapter-image-wrapper {
    flex: none;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
  .chapter-actions {
    flex-direction: column;
    gap: 15px;
  }
  .reorder-controls {
    min-width: auto;
    width: 100%;
  }
  .action-buttons {
    flex-direction: column;
    gap: 10px;
  }
  .action-buttons button {
    min-width: auto;
    width: 100%;
    font-size: 13px;
    padding: 12px;
    margin: 0;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .chapter-header-section {
    gap: 25px;
  }
  .chapter-image-wrapper {
    flex: 0 0 180px;
    width: 180px;
  }
  .chapter-actions {
    flex-wrap: wrap;
    gap: 15px;
  }
  .action-buttons {
    gap: 12px;
  }
  .action-buttons button {
    min-width: 130px;
  }
}

/* Desktop */
@media (min-width: 1025px) {
  .chapter-header-section {
    gap: 30px;
  }
  .chapter-image-wrapper {
    flex: 0 0 220px;
    width: 220px;
  }
  .chapter-actions {
    gap: 25px;
  }
  .reorder-controls {
    min-width: 180px;
  }
  .action-buttons button {
    min-width: 150px;
  }
}

/* Large desktop */
@media (min-width: 1400px) {
  .chapters-section {
    max-width: 1300px;
  }
  .chapter-row {
    padding: 30px;
    gap: 25px;
  }
  .chapter-header-section {
    gap: 35px;
  }
  .chapter-image-wrapper {
    flex: 0 0 240px;
    width: 240px;
  }
}

/* Hover and content styles */
.chapter-image-wrapper img,
.chapter-image-wrapper > section {
  transition: all 0.3s ease;
  border-radius: 8px;
}

/* ==========================================
   Editing Alert Bar and Info Banners
   ========================================== */

/* Editing alert shown when a chapter is being edited */
.edit-alert {
  background-color: #e7f3ff;
  border: 1px solid #b3d9ff;
  padding: 10px;
  margin-bottom: 1em;
  border-radius: 5px;
}

.edit-alert .edit-cancel-link {
  float: right;
  color: #666;
  text-decoration: none;
  font-size: 12px;
}

.edit-alert .edit-cancel-link:hover {
  text-decoration: underline;
  color: #333;
}

/* Generic info banner */
.info-banner {
  padding: 12px 15px;
  border-radius: 5px;
  margin-bottom: 15px;
}

/* Warning (yellow) variants */
.info-banner.warning {
  background-color: #fff3cd;
  border: 2px solid #ffc107;
  border-left: 5px solid #ff6b35;
  color: #856404;
}

/* Compact version of warning banner (no full border, only left accent) */
.info-banner.warning.compact {
  border: none;
  border-left: 4px solid #ffc107;
  padding: 10px 12px;
  margin-bottom: 10px;
}

/* Informational (blue) variant */
.info-banner.info {
  background-color: #e7f3ff;
  border-left: 4px solid #007bff;
  font-size: 14px;
  margin-top: 10px;
}

/* Typography inside banners */
.info-banner {
  color: inherit;
  margin-top: 0;
  margin-bottom: 0.5em;
}

.info-banner p {
  color: inherit;
  margin-bottom: 0;
}

/* Container for main content */
> * {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styling */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  padding: 2rem 0;
  margin-bottom: 3rem;
}
header img {
  background-color: aliceblue;
  width: 100px;
  height: 100px;
}
.chapter-management {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2d3748;
  margin: 0 0 1rem 0;
  text-shadow: none;
  text-transform: none;
  letter-spacing: -0.5px;
  text-align: center;
}

.add-a-chapter {
  font-size: 2.2rem;
  font-weight: 400;
  color: #718096;
  margin: 0;
  text-shadow: none;
  text-transform: none;
  background: none;
  padding: 0;
  text-align: center;
}

/* Form Container */
form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  margin: 2rem auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
}

/* Form Labels */
label {
  display: block;
  margin: 2rem auto 0.5rem auto;
  font-weight: 600;
  font-size: 1.5rem;
  color: #2d3748;
  letter-spacing: 0.3px;
  text-align: center;
  max-width: 600px;
}


.customize-theme-active {
  color: #856404; 
  margin-top: 0;
  font-size: clamp(1.1rem, 1.5vw + 0.7rem, 1.5rem);
}

/* Buttons */
button,
.button {
  background: linear-gradient(135deg, #fafafb 0%, #d3e9fe 100%);
  border: none;
  border-bottom: 2px solid #111;
  color: #333;
  backdrop-filter: blur(10px);
  padding: 0.8rem 1.5rem;
  text-decoration: none !important;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
}

button:hover,
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
}

/* Disabled button state */
button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  pointer-events: none; /* Prevent any click events */
}

button:disabled:hover,
.button:disabled:hover {
  transform: none; /* Prevent hover transform on disabled buttons */
  box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3); /* Keep original shadow */
}

/* Special Button Variants */
button.delete-chapter {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

button.delete-chapter:hover {
  box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
}

/* App Description Section */
.app-description {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2.5rem;
  margin: 2rem auto;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  justify-content: center;
}

.app-description p {
  font-size: 1.2rem;
  line-height: 1.7;
  color: #4a5568;
  margin-bottom: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.app-description .justify-content-center {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.customize-theme-important {
  color: #856404; 
  margin-bottom: 0; 
  font-weight: 500;
}
.app-description .button {
  background: rgba(66, 153, 225, 0.1);
  color: #4299e1;
  border: 2px solid #4299e1;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-block;
}

.app-description .button:hover {
  background: #4299e1;
  color: white;
  transform: translateY(-2px);
}

/* Fixed Action Buttons */
.fixed-buttons {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fixed-buttons button {
  background: linear-gradient(135deg, #fafafb 0%, #d3e9fe 100%);
  border-bottom: 2px solid #111;
  color: #333;
  backdrop-filter: blur(10px);
  padding: 0.8rem 1.5rem;
  text-decoration: none !important;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  display: inline-block;
}

.fixed-buttons a:hover,
.fixed-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}


/* Quick action buttons styling */
.fixed-buttons a.quick-action {
  font-weight: 600;
  transition: all 0.2s ease;
}

.fixed-buttons a.quick-action:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
}

.fixed-buttons a.quick-action:active {
  transform: translateY(-1px) scale(0.98);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 4rem;
  padding: 1rem;
  background: rgb(255, 255, 255);
  backdrop-filter: blur(10px);
  color: #718096;
  font-size: 0.9rem;
  border-radius: 16px;
}

/* Paragraphs and Text */
p {
  margin-bottom: 1rem;
  color: #4a5568;
  line-height: 1.2;
}

/* Links */
a {
  color: #4299e1;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #3182ce;
}

/* Information Boxes */
section[style*="background-color: #e8f4fd"],
section[style*="background-color: #fff3cd"],
section[style*="background-color: #d1ecf1"],
section[style*="background-color: #d4edda"] {
  background: rgba(66, 153, 225, 0.1) !important;
  border: 1px solid rgba(66, 153, 225, 0.2) !important;
  border-radius: 12px !important;
  padding: 1.5rem !important;
  margin: 1.5rem auto !important;
  color: #2d3748 !important;
  border-left: 4px solid #4299e1 !important;
  max-width: 800px !important;
  text-align: center !important;
}

/* Project Management Section */
section[style*="border: 1px solid #ddd"] {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 16px !important;
  padding: 2rem !important;
  margin: 2rem 0 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

/* Checkboxes */
input[type="checkbox"] {
  width: auto !important;
  margin-right: 0.5rem;
  transform: scale(1.2);
}

/* Checkbox Labels */
.checkbox-label {
  display: flex !important;
  align-items: center;
  font-weight: normal !important;
  margin-bottom: 8px !important;
  margin-top: 0 !important;
  text-align: left !important;
}

/* Meta cover image styling */
.meta-cover-image {
  max-width: 300px;
  height: auto;
  display: block;
  margin: 15px auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Theme selector styling */
.theme-select {
  background-color: #f8f9fa !important;
  color: #495057 !important;
  padding: 1rem !important;
  border-radius: 8px !important;
  border: 3px solid #93bbea !important;
  font-size: 1rem !important;
  font-family: inherit !important;
  width: 100% !important;
  max-width: 600px !important;
  margin: 0.5rem auto 0 auto !important;
  display: block !important;
  box-sizing: border-box !important;
}

/* Theme selector options */
.theme-select option {
  background-color: #f8f9fa !important;
  color: #495057 !important;
  padding: 8px !important;
}

/* Button variants */
.button.success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3) !important;
}

.button.success:hover {
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4) !important;
}

.button.danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3) !important;
}
.text-danger {
  color: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
  font-weight: 400;
}
.button.danger:hover {
  box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4) !important;
}

.button.info {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
  box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3) !important;
}

.button.info:hover {
  box-shadow: 0 8px 25px rgba(23, 162, 184, 0.4) !important;
}

/* File inputs */
input[type="file"] {
  padding: 0.8rem;
  border: 2px dashed #e1e8ed;
  background: #f8f9fa;
  cursor: pointer;
}

input[type="file"]:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

/* Post-form content styling */
form ~ * {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 800px !important;
}

form ~ section,
form ~ button {
  text-align: center !important;
}

/* Project management and post-form sections */
form ~ section {
  text-align: center !important;
}

form ~ section p {
  text-align: center !important;
}

/* Warning button colors for specific actions */
button[onclick*="clearForm"],
.button[onclick*="clearForm"] {
  background: linear-gradient(135deg, #f6d55c 0%, #ed8b00 100%) !important;
  color: #2d3748 !important;
  box-shadow: 0 4px 15px rgba(246, 213, 92, 0.3) !important;
}

button[onclick*="clearForm"]:hover,
.button[onclick*="clearForm"]:hover {
  box-shadow: 0 8px 25px rgba(246, 213, 92, 0.4) !important;
}

/* Delete project button - red warning */
a[onclick*="confirm"],
button[onclick*="confirm"],
.button[onclick*="confirm"] {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%) !important;
  color: white !important;
  box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3) !important;
}

a[onclick*="confirm"]:hover,
button[onclick*="confirm"]:hover,
.button[onclick*="confirm"]:hover {
  box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4) !important;
}

/* Reader view button styling */
form ~ section a {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%) !important;
  color: white !important;
  border-radius: 8px !important;
  padding: 12px 24px !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  display: inline-block !important;
  margin: 0.5rem !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3) !important;
}

form ~ section a:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4) !important;
}

/* Download backup button - keep green */
a[href*="download_project"] {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%) !important;
  color: white !important;
  box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3) !important;
}

a[href*="download_project"]:hover {
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 0 10px;
  }
  
  form {
    padding: 2rem;
    margin: 1rem auto;
  }

  .app-description .justify-content-center {
    flex-direction: column;
  }
  
  .fixed-buttons {
    position: static;
    flex-direction: row;
    justify-content: center;
    margin: 1rem 0;
  }
  
  .fixed-buttons a {
    font-size: 0.8rem;
    padding: 0.6rem 1rem;
  }
}

/* Additional responsive breakpoints for fixed buttons */
@media (max-width: 1200px) {
  .fixed-buttons {
    right: 15px;
  }
  
  .fixed-buttons a {
    font-size: 0.85rem;
    padding: 0.7rem 1.3rem;
  }
}

@media (max-width: 1024px) {
  .fixed-buttons {
    right: 10px;
    gap: 8px;
  }
  
  .fixed-buttons a {
    font-size: 0.8rem;
    padding: 0.65rem 1.2rem;
  }
}

@media (max-width: 900px) {
  .fixed-buttons {
    position: fixed; /* Keep them fixed instead of static */
    right: 8px;
    gap: 6px;
  }
  
  .fixed-buttons a {
    font-size: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
  }
}

@media (max-width: 768px) {
  /* Override the previous static positioning for very small screens */
  .fixed-buttons {
    position: static;
    flex-direction: row;
    justify-content: center;
    margin: 1rem 0;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .fixed-buttons a {
    font-size: 0.7rem;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .fixed-buttons a {
    font-size: 0.65rem;
    padding: 0.4rem 0.6rem;
    min-width: 100px;
    /* Truncate long text on very small screens */
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Chapter and Editor Components (for book_chapter.html) */
.chapter-actions {
  margin-top: 15px;
  text-align: center;
}

/* Text Center Utility */
.text-center {
  text-align: center;
}

/* =========================================
   HEADER DIFFERENTIATION IN EDITOR
   Clear visual hierarchy for h1-h6
   ========================================= */

h1 {
  font-size: 2.5em !important;
  font-weight: 700 !important;
  color: #1a202c !important;
  margin-top: 1em !important;
  margin-bottom: 0.5em !important;
  padding-bottom: 0.3em !important;
  border-bottom: 3px solid #4299e1 !important;
  line-height: 1.2 !important;
}

h2 {
  font-size: 2em !important;
  font-weight: 600 !important;
  color: #2d3748 !important;
  margin-top: 0.9em !important;
  margin-bottom: 0.45em !important;
  padding-bottom: 0.25em !important;
  border-bottom: 2px solid #90cdf4 !important;
  line-height: 1.25 !important;
}

h3 {
  font-size: 1.6em !important;
  font-weight: 600 !important;
  color: #4a5568 !important;
  margin-top: 0.8em !important;
  margin-bottom: 0.4em !important;
  line-height: 1.3 !important;
}

h4 {
  font-size: 1.35em !important;
  font-weight: 600 !important;
  color: #4a5568 !important;
  margin-top: 0.75em !important;
  margin-bottom: 0.35em !important;
  line-height: 1.35 !important;
}

h5 {
  font-size: 1.15em !important;
  font-weight: 600 !important;
  color: #718096 !important;
  margin-top: 0.7em !important;
  margin-bottom: 0.3em !important;
  line-height: 1.4 !important;
}

h6 {
  font-size: 1em !important;
  font-weight: 700 !important;
  color: #718096 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  margin-top: 0.65em !important;
  margin-bottom: 0.25em !important;
  line-height: 1.4 !important;
}

/* Ensure HTML editor textarea remains readable */
#htmlTextarea {
  text-align: left !important;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
  background: white !important;
  color: #333 !important;
  max-width: none !important;
}


/* =========================================
   MEDIA GALLERY UI (used in book_chapter.html)
   ========================================= */

/* Gallery container optional hook */
.media-gallery {
  /* Hook class for media gallery containers */
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 15px;
}

/* Card wrapper for both photos and videos */
.media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: 200px;
  border: 1px solid #ddd;
  padding: 8px;
  gap: 6px;
}

.media-card.photo {
  border: 2px solid #ddd;
}

.media-card.video {
  border: 2px solid #28a745;
}

/* Thumbnail image */
.media-thumb {
  width: 120px;
  height: 80px;
  object-fit: cover;
  display: block;
}

/* Buttons area under thumbnail */
.media-card-buttons {
  padding: 6px;
  text-align: center;
  background: #f8f9fa;
}

.media-card-label {
  font-size: 10px;
  color: #666;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-size {
  font-size: 9px;
  color: #999;
  margin-bottom: 4px;
}

/* Buttons */
.media-card .media-btn {
  border: none !important;
  padding: 2px 6px !important;
  border-radius: 3px !important;
  font-size: 10px !important;
  cursor: pointer;
  font-weight: normal !important;
  margin: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  transition: opacity 0.2s ease !important;
  display: inline-block;
  text-decoration: none !important;
}

.media-card .media-btn:hover {
  opacity: 0.8;
  transform: none !important;
  box-shadow: none !important;
}

.media-card .media-btn + .media-btn {
  margin-left: 4px !important;
}

.media-card .media-btn-insert-blue {
  background-color: #007bff !important;
  color: #000000 !important;
}

.media-card .media-btn-insert-green {
  background-color: #28a745 !important;
  color: #000000 !important;
}

.media-card .media-btn-delete {
  background-color: #dc3545 !important;
  color: #000000 !important;
}

.media-btn-gray {
  background-color: #6c757d;
  color: #000000;
}

/* Video preview tile */
.media-video-preview {
  width: 120px;
  height: 80px;
  background: linear-gradient(135deg, #28a745, #34ce57);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
}

/* Empty-state message */
.no-media-message {
  color: #888;
  font-style: italic;
  text-align: center;
  margin: 20px 0;
}

/* JS loaded indicator badge */
#js-loaded-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background: #28a745;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 10000;
  opacity: 0.8;
}

/* Preview box (used by previewContent) */
.preview-box {
  margin-top: 1em;
  padding: 1em;
  border: 1px solid #ddd;
  background-color: #f9f9f9;
  border-radius: 5px;
}

/* Chapter header image sections */
.chapter-image-selected {
  display: none;
  margin: 10px 0;
  padding: 8px;
  background-color: #e8f4fd;
  border-radius: 4px;
  color: #007bff;
  font-size: 14px;
  border: 1px solid #b3d9ff;
}

.chapter-image-selected .file-summary {
  text-align: center;
  margin-bottom: 10px;
}

.chapter-image-preview {
  margin-top: 10px;
  text-align: center;
}

.chapter-image-preview img {
  max-width: 500px;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
  margin: 0 auto;
}

/* Ensure explicit class also applies when used directly */
.chapter-image-preview-img {
  max-width: 500px;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
  margin: 0 auto;
}

.chapter-image-current {
  margin-top: 8px;
  padding: 8px;
  background-color: #f0f8ff;
  border: 1px solid #b3d9ff;
  border-radius: 4px;
}

.chapter-image-current .current-filename {
  color: #0066cc;
  display: block;
  margin-bottom: 8px;
  text-align: center;
}

.chapter-image-current .current-preview {
  text-align: center;
  margin-bottom: 15px;
}

.chapter-image-placeholder {
  margin-top: 8px;
  padding: 8px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  color: #6c757d;
  font-size: 14px;
}

/* Medium padding variant for media buttons */
.media-btn-md {
  padding: 8px 16px;
}

/* Flash messages - Enhanced version */
#flash-messages {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 999999 !important;
  margin: 0 auto !important;
  padding: 0;
  max-width: 600px;
  width: 90%;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 15px;
  pointer-events: auto !important;
}

.flash-message {
  border-radius: 12px;
  padding: 20px 25px;
  position: relative;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  font-size: 18px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  margin: 0;
  animation: slideInBounce 0.8s ease-out;
  width: 100%;
  box-sizing: border-box;
}

.flash-error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border: 3px solid #f5c6cb;
  box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3), 0 0 20px rgba(220, 53, 69, 0.2);
  animation: flashErrorPulse 2s ease-out, slideInBounce 0.8s ease-out, shake 0.8s ease-in-out, fadeOut 1s ease-out 7s forwards !important;
}

.flash-success {
  background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
  color: #0f5132;
  border: 3px solid #badbcc;
  box-shadow: 0 8px 25px rgba(25, 135, 84, 0.3), 0 0 20px rgba(25, 135, 84, 0.2);
  animation: flashSuccessPulse 2s ease-out, slideInBounce 0.8s ease-out, fadeOut 1s ease-out 7s forwards;
}

.flash-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.flash-icon {
  font-size: 28px;
  animation: pulse 1s infinite;
}

.flash-close {
  position: absolute;
  right: 15px;
  top: 15px;
  background: rgba(255,255,255,0.8);
  border: none;
  font-size: 24px;
  color: inherit;
  cursor: pointer;
  padding: 5px 8px;
  line-height: 1;
  font-weight: bold;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.flash-message:hover {
  transform: translateY(-3px) scale(1.02);
  transition: all 0.3s ease;
}

.flash-message button:hover {
  background: rgba(255,255,255,1) !important;
  transform: scale(1.1);
}

.flash-close:hover {
  background: rgba(255,255,255,1);
  transform: scale(1.1);
}

.flash-more-note {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #6c757d;
  padding: 15px 20px;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

/* Alert styles for redemption page and other pages */
.alert {
  position: relative;
  padding: 15px;
  margin: 20px auto;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  box-sizing: border-box;
  font-size: 16px;
  text-align: center;
}

.alert-success {
  background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
  color: #0f5132;
  border: 2px solid #badbcc;
}

.alert-error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border: 2px solid #f5c6cb;
}

@keyframes slideInBounce {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0.8);
  }
  60% {
    opacity: 1;
    transform: translateY(5px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flashErrorPulse {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3), 0 0 20px rgba(220, 53, 69, 0.2);
  }
  50% {
    box-shadow: 0 12px 35px rgba(220, 53, 69, 0.5), 0 0 30px rgba(220, 53, 69, 0.4);
    transform: translateY(-2px);
  }
}

@keyframes flashSuccessPulse {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(25, 135, 84, 0.3), 0 0 20px rgba(25, 135, 84, 0.2);
  }
  50% {
    box-shadow: 0 12px 35px rgba(25, 135, 84, 0.5), 0 0 30px rgba(25, 135, 84, 0.4);
    transform: translateY(-2px);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes shake {
  0%, 20%, 40%, 60%, 80% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-8px);
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    pointer-events: none;
  }
}

@media (max-width: 768px) {
  #flash-messages {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 95%;
  }
  
  .flash-message {
    font-size: 16px !important;
    padding: 15px 20px !important;
  }
  
  .flash-message span:first-child {
    font-size: 24px !important;
  }
}

/* Media library container and header */
.media-library-container {
  margin-bottom: 2em;
  padding: 15px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  background-color: #fafafa;
  justify-content: center;
}

/* ============================================
   STICKY MEDIA LIBRARY SIDEBAR (NEW)
   ============================================ */

.media-library-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: linear-gradient(to bottom, #f8f9fa, #ffffff);
  border-right: 2px solid #dee2e6;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Always hidden by default, show when active */
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s ease;
}

/* Show when active class is added by JavaScript */
.media-library-sidebar.active {
  transform: translateX(0);
  visibility: visible;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
}

.media-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border-bottom: 2px solid #003d82;
  flex-shrink: 0;
}

.media-sidebar-title {
  color: white;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
}

.media-sidebar-header .media-refresh-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  padding: 6px 10px !important;
  font-size: 16px !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.media-sidebar-header .media-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.05);
}

.media-sidebar-upload {
  padding: 20px 15px;
  background: white;
  border-bottom: 1px solid #dee2e6;
  flex-shrink: 0;
}

/* Media sidebar buttons match standard button styling */
.media-sidebar-upload button {
  width: 100%;
  margin-bottom: 12px;
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #fafafb 0%, #d3e9fe 100%);
  border-bottom: 2px solid #111;
  color: #333;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.media-sidebar-upload button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.media-sidebar-upload button:last-of-type {
  margin-bottom: 0;
}

.media-upload-hint {
  font-size: 11px;
  color: #6c757d;
  text-align: center;
  margin-top: 15px;
  padding-top: 12px;
  line-height: 1.5;
  border-top: 1px solid #e9ecef;
}

.media-library-sidebar .media-gallery {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  background: white;
}

.media-library-sidebar .upload-loading {
  padding: 10px 15px;
  background: #fff3cd;
  border-top: 1px solid #ffc107;
  text-align: center;
  font-size: 12px;
  color: #856404;
  flex-shrink: 0;
}

/* ============================================
   ACTIONS SIDEBAR (RIGHT)
   ============================================ */

.actions-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 300px;
  height: 100vh;
  background: linear-gradient(to bottom, #f8f9fa, #ffffff);
  border-left: 2px solid #dee2e6;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Always hidden by default, show when active */
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s ease;
}

/* Show when active class is added by JavaScript */
.actions-sidebar.active {
  transform: translateX(0);
  visibility: visible;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
}

.actions-sidebar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  border-bottom: 2px solid #1e7e34;
  flex-shrink: 0;
}

.actions-sidebar-title {
  color: white;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
}

.actions-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: white;
}

/* Fixed buttons inside actions sidebar */
.actions-sidebar .fixed-buttons {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.actions-sidebar .fixed-buttons a,
.actions-sidebar .fixed-buttons button {
  margin: 0;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  font-size: 0.9rem;
  padding: 12px 16px;
  white-space: normal;
}

/* Main content area - responsive with hover sidebars */
.main-content-area {
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  width: 100%;
  /* Use full width on mobile, constrained width on larger screens */
  max-width: none;
  margin: 0;
  /* Smooth transitions for responsive changes */
  transition: padding 0.3s ease, max-width 0.3s ease;
}

/* Media cards in sidebar - optimized for narrow width */
.media-library-sidebar .media-card {
  width: 100%;
  margin-bottom: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.media-library-sidebar .media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-library-sidebar .media-thumb {
  width: 100%;
  height: auto;
  max-height: 150px;
  object-fit: cover;
  display: block;
}

.media-library-sidebar .media-video-preview {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #9f7aea, #805ad5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-library-sidebar .media-video-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-library-sidebar .media-card-buttons {
  padding: 12px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-library-sidebar .media-card-label {
  font-size: 11px;
  color: #495057;
  margin-bottom: 4px;
  font-weight: 500;
  word-break: break-word;
}

.media-library-sidebar .media-card-size {
  font-size: 10px;
  color: #6c757d;
  margin-bottom: 8px;
}

.media-library-sidebar .media-btn {
  width: 100%;
  padding: 10px 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  text-align: center;
  display: block;
  margin: 0 !important;
  transition: all 0.2s ease !important;
}

.media-library-sidebar .media-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

/* Scrollbar styling for sidebar */
.media-library-sidebar .media-gallery::-webkit-scrollbar {
  width: 8px;
}

.media-library-sidebar .media-gallery::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.media-library-sidebar .media-gallery::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.media-library-sidebar .media-gallery::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.media-library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.media-library-label {
  font-weight: bold;
  color: #333;
  margin: 0;
}

.media-library-description {
  color: #666;
  font-size: 14px;
  margin-bottom: 15px;
}

.media-library-description small {
  color: #888;
}

.media-upload-area {
  margin-bottom: 15px;
}

.media-upload-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

/* .media-upload-group - Wrapper for input and button pairs (no styles needed currently) */

.media-input {
  margin-bottom: 5px;
}

.media-upload-info {
  color: #666;
  font-size: 12px;
}

.upload-loading {
  display: none;
  color: #007bff;
  font-style: italic;
}

.emphasis {
  font-style: italic;
  font-weight: 500;
  color: #333;
  margin-left: 1rem;
  margin-right: 1rem;
  font-size: 12px;
}

/* ==============================
   MODAL OVERLAY STYLES
   ============================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: 600px;
  min-width: 400px;
  width: auto;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

.warning-modal {
  border: 3px solid #ff6b35;
}

.warning-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.warning-title {
  margin: 0 0 15px 0;
  color: #d63031;
  font-size: 24px;
  font-weight: bold;
}

.warning-message {
  margin: 0 0 20px 0;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
}

.warning-button {
  background-color: #d63031;
  color: rgb(0, 0, 0);
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s ease;
}

.warning-button:hover {
  background-color: #b92d32;
}

/* Loading Modal Styles */
.loading-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  background-color: rgba(0, 0, 0, 0.7) !important;
  z-index: 999999 !important;
  display: none !important;
  justify-content: center !important;
  align-items: center !important;
  animation: fadeIn 0.3s ease-out;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  /* Ensure no parent transform affects this */
  will-change: auto !important;
}

.loading-modal.active {
  display: flex !important;
}

.loading-content {
  background: white !important;
  padding: 30px !important;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  text-align: center !important;
  border: 2px solid #007bff;
  animation: slideIn 0.3s ease-out;
  max-width: 500px;
  min-width: 300px;
  width: auto;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

.loading-icon {
  font-size: 48px;
  margin: 0 auto 15px auto;
  text-align: center;
}

.loading-title {
  font-size: 18px;
  font-weight: bold;
  margin: 0 auto 10px auto;
  text-align: center;
  color: #2d3748;
}

.loading-message {
  color: #666;
  font-size: 14px;
  margin: 0 auto;
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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


/* Support for inline text-align styles as fallback */
video[style*="text-align: center"] {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

video[style*="text-align: right"] {
  display: block;
  margin-left: auto;
  margin-right: 0;
}

video[style*="text-align: justify"] {
  display: block;
  width: 100%;
}

/* Tooltips */
.tooltip {
  position: relative; /* Needed for positioning the tooltiptext */
  display: inline-block; /* Allows the tooltip to wrap around its content */
  border-bottom: 1px dotted black; /* Optional: adds a visual cue */
  cursor: help; /* Show help cursor on hover */
}

.tooltip .tooltiptext {
  visibility: hidden; /* Hidden by default */
  min-width: 200px; /* Minimum width for readability */
  max-width: 300px; /* Maximum width to prevent overflow */
  width: max-content; /* Adapts to content size */
  background-color: #2c3e50; /* Professional dark background */
  color: #fff; /* White text */
  text-align: center;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.875rem; /* 14px - readable size */
  line-height: 1.4;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Positioning the tooltip */
  position: absolute;
  z-index: 9999; /* Ensures it appears above other content */
  bottom: 125%; /* Positions above the hover element */
  left: 50%;
  transform: translateX(-50%); /* Better centering method */

  opacity: 0; /* Starts invisible for smooth transition */
  transition: opacity 0.3s ease-in-out, visibility 0.3s; /* Smooth fade-in effect */
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%; /* Positions the arrow below the tooltip box */
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #2c3e50 transparent transparent transparent; /* Creates a downward-pointing arrow */
}

.tooltip:hover .tooltiptext {
  visibility: visible; /* Shows the tooltip on hover */
  opacity: 1; /* Fades in the tooltip */
}

/* Responsive adjustments for tooltips on smaller screens */
@media (max-width: 768px) {
  .tooltip .tooltiptext {
    min-width: 180px;
    max-width: 250px;
    font-size: 0.813rem; /* 13px - slightly smaller for mobile */
    padding: 6px 10px;
    bottom: 130%; /* Slightly higher to avoid finger/cursor */
  }
}

@media (max-width: 480px) {
  .tooltip .tooltiptext {
    min-width: 150px;
    max-width: 200px;
    font-size: 0.75rem; /* 12px - compact for small screens */
    padding: 6px 8px;
    
    /* On very small screens, position to the right to avoid edge cutoff */
    left: auto;
    right: 0;
    transform: none;
  }
  
  .tooltip .tooltiptext::after {
    left: auto;
    right: 20px; /* Align arrow with repositioned tooltip */
  }
}

/* ============================================
   RESPONSIVE SIDEBAR CONTROLS
   ============================================ */

/* Mobile menu toggle buttons */
.sidebar-toggle {
  display: none;
  position: fixed;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  font-size: 18px;
  line-height: 1;
  color: #4a5568;
}

.sidebar-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle-left {
  top: 20px;
  left: 20px;
}

.sidebar-toggle-right {
  top: 20px;
  right: 20px;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 850;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* Hover trigger zone with visible arrows */
.sidebar-hover-trigger {
  display: none;
  position: fixed;
  width: 30px;
  height: 100vh;
  z-index: 899;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  /* Temporary debug background - remove later */
  /* background: rgba(255, 0, 0, 0.1); */
}

.sidebar-hover-trigger-left-zone {
  left: 0;
  top: 0;
}

.sidebar-hover-trigger-left-zone:hover {
  background: linear-gradient(to right, rgba(66, 153, 225, 0.15), transparent);
}

.sidebar-hover-trigger-right-zone {
  right: 0;
  top: 0;
}

.sidebar-hover-trigger-right-zone:hover {
  background: linear-gradient(to left, rgba(40, 167, 69, 0.15), transparent);
}

/* Left trigger visual indicators */
.sidebar-hover-trigger-left-zone::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, rgba(66, 153, 225, 0.6), transparent);
  border-radius: 0 6px 6px 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-hover-trigger-left-zone:hover::after {
  opacity: 1;
}

.sidebar-hover-trigger-left-zone::before {
  content: '📸';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: rgba(66, 153, 225, 0.8);
  background: rgba(255, 255, 255, 0.9);
  padding: 8px;
  border-radius: 0 8px 8px 0;
  border: 2px solid rgba(66, 153, 225, 0.3);
  animation: pulseHint 4s ease-in-out infinite;
  animation-delay: 3s;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-hover-trigger-left-zone:hover::before {
  animation: none;
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* Right trigger visual indicators */
.sidebar-hover-trigger-right-zone::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, rgba(40, 167, 69, 0.6), transparent);
  border-radius: 6px 0 0 6px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-hover-trigger-right-zone:hover::after {
  opacity: 1;
}

.sidebar-hover-trigger-right-zone::before {
  content: '⚡';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: rgba(40, 167, 69, 0.8);
  background: rgba(255, 255, 255, 0.9);
  padding: 8px;
  border-radius: 8px 0 0 8px;
  border: 2px solid rgba(40, 167, 69, 0.3);
  animation: pulseHint 4s ease-in-out infinite;
  animation-delay: 3.5s;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-hover-trigger-right-zone:hover::before {
  animation: none;
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* Pulse animation to hint at the hover areas */
@keyframes pulseHint {
  0%, 100% { 
    opacity: 0.3; 
    transform: translateY(-50%) scale(1);
  }
  50% { 
    opacity: 0.9; 
    transform: translateY(-50%) scale(1.05);
  }
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Large Desktop - Full sidebar experience */
@media (min-width: 1200px) {
  .media-library-sidebar {
    width: 300px;
  }
  
  .actions-sidebar {
    width: 320px;
  }
  
  .main-content-area {
    margin-left: 300px;
    margin-right: 320px;
  }
}

/* ============================================
   RESPONSIVE DESIGN - HOVER SIDEBARS
   ============================================ */

/* All screen sizes - consistent hover behavior */
@media (min-width: 768px) {
  /* Show hover trigger zones */
  .sidebar-hover-trigger {
    display: block !important;
  }
  
  /* Keep sidebar toggles visible for accessibility but make them less prominent */
  .sidebar-toggle-left,
  .sidebar-toggle-right {
    display: block;
    opacity: 0.4;
    transition: opacity 0.2s ease;
  }
  
  .sidebar-toggle-left:hover,
  .sidebar-toggle-right:hover {
    opacity: 1;
  }
  
  /* Tablet: Constrain max-width and center content */
  .main-content-area {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 30px;
  }
}

/* Desktop - Make hover triggers always available */
@media (min-width: 1024px) {
  .sidebar-hover-trigger {
    display: block !important;
  }
  
  /* Hide toggle buttons on desktop since hover works better */
  .sidebar-toggle-left,
  .sidebar-toggle-right {
    display: none;
  }
  
  /* Desktop: Larger max-width for better use of space */
  .main-content-area {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 40px;
  }
}

/* Large Desktop: Even more space for content */
@media (min-width: 1200px) {
  .main-content-area {
    max-width: 1200px;
    padding: 20px 50px;
  }
}

/* Very Large Desktop: Maximum comfortable reading width */
@media (min-width: 1400px) {
  .main-content-area {
    max-width: 1300px;
    padding: 20px 60px;
  }
}

/* ============================================
   INTERMEDIATE RESPONSIVE BREAKPOINTS
   ============================================ */

/* Small tablet / large mobile landscape */
@media (min-width: 481px) and (max-width: 767px) {
  .main-content-area {
    padding: 20px;
    max-width: none;
    margin: 0;
    width: 100%;
  }
}

/* Medium tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .main-content-area {
    max-width: 750px;
    margin: 0 auto;
    padding: 20px 25px;
  }
}

/* Large tablet / small desktop */
@media (min-width: 1024px) and (max-width: 1199px) {
  .main-content-area {
    max-width: 950px;
    margin: 0 auto;
    padding: 20px 35px;
  }
}

/* Mobile - Keep existing mobile behavior for touch devices */
@media (max-width: 767px) {
  .media-library-sidebar {
    width: 90%;
    max-width: 320px;
    /* Keep transform behavior but trigger with touch/click */
  }
  
  .actions-sidebar {
    width: 90%;
    max-width: 320px;
    /* Keep transform behavior but trigger with touch/click */
  }
  
  .media-library-sidebar.active {
    transform: translateX(0);
    visibility: visible;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
  }
  
  .actions-sidebar.active {
    transform: translateX(0);
    visibility: visible;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.3);
  }
  
  .main-content-area {
    padding: 15px;
    padding-top: 70px; /* Space for toggle buttons */
    max-width: none; /* Use full width on mobile */
    margin: 0; /* Remove auto margins */
    width: 100%; /* Ensure full width usage */
  }
  
  .sidebar-toggle-left,
  .sidebar-toggle-right {
    display: block;
  }
  
  .sidebar-toggle-right {
    top: 80px; /* Below left toggle */
  }
  
  /* Mobile: Keep fixed buttons inside actions sidebar */
  .actions-sidebar .fixed-buttons {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  
  .actions-sidebar .fixed-buttons a,
  .actions-sidebar .fixed-buttons button {
    font-size: 0.85rem;
    padding: 12px 16px;
    width: 100%;
    margin: 0;
    white-space: normal;
  }
}

/* Very Small Mobile - Further optimize */
@media (max-width: 480px) {
  .media-library-sidebar {
    width: 95%;
  }
  
  .actions-sidebar {
    width: 95%;
  }
  
  .main-content-area {
    padding: 10px;
    padding-top: 75px;
    width: 100%;
    margin: 0;
  }
  
  .sidebar-toggle {
    padding: 8px;
    font-size: 16px;
  }
  
  .fixed-buttons {
    bottom: 10px;
    gap: 6px;
    padding: 8px;
    max-width: calc(100% - 20px);
  }
  
  .fixed-buttons a {
    font-size: 0.65rem;
    padding: 0.4rem 0.6rem;
  }
}
.justify-content-center {
  justify-content: center;
}

.sidebar-divider {
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
}

/* =========================================
   CHAPTER PREVIEW MODE STYLES
   ========================================= */

/* Preview container styling */
#previewContainer {
  transition: opacity 0.3s ease-in-out;
}

#previewContent {
  /* Reset builder.css interference for preview */
  background: white;
  max-width: 100%;
  font-family: inherit;
}

/* Ensure preview content uses theme styles, not builder styles */
#previewContent * {
  /* Let theme CSS take precedence */
  box-sizing: border-box;
}

/* Preview button active state */
#previewModeBtn.active {
  background-color: #28a745;
  color: white;
}

/* =========================================
   PREVIEW MODAL STYLES
   ========================================= */

.preview-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.preview-modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
  z-index: 10000;
}

.preview-modal-content {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 85%;
  max-width: 1000px;
  height: 70vh;
  max-height: 700px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 10001;
  overflow: hidden;
}

.preview-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #ddd;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}

.preview-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
}

.preview-modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.preview-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #000;
}

.preview-modal-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .preview-modal-content {
    width: 90%;
    height: 75vh;
    max-height: 600px;
  }
  
  .preview-modal-header {
    padding: 8px 12px;
  }
  
  .preview-modal-header h3 {
    font-size: 1rem;
  }
  
  .preview-modal-close {
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
  }
}

@media (max-height: 700px) {
  .preview-modal-content {
    height: 80vh;
    max-height: 80vh;
  }
  
  .preview-modal-header {
    padding: 6px 12px;
  }
}

@media (max-height: 500px) {
  .preview-modal-content {
    height: 90vh;
    max-height: 90vh;
  }
}

/* Ensure the editor info banner stays below dropdowns */
#editorInfo {
  position: relative;
  z-index: 1 !important;
}

/* Editor area general z-index */
.editor-area {
  position: relative;
  z-index: 10 !important;
}

/* Page Center Container - Visual Indication in Editor */
.page-center-container {
  /* Container styling to make it visible in the editor */
  border: 2px dashed #007bff;
  background-color: #f0f8ff;
  border-radius: 8px;
  padding: 2rem;
  margin: 1rem 0;
  min-height: 200px;
  position: relative;
}

/* Add a label to indicate this is a centered section */
.page-center-container::before {
  content: '📍 Centered Content Section';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #007bff;
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ensure content inside is centered in the editor view */
.page-center-container > * {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   CITATION LIBRARY SIDEBAR (LEFT, BELOW MEDIA)
   ============================================ */

.citation-library-sidebar {
  position: fixed;
  left: 0;
  top: 50vh; /* Position below media library */
  width: 280px;
  height: 50vh;
  background: linear-gradient(to bottom, #fefcf9, #ffffff);
  border-right: 2px solid #dee2e6;
  border-top: 2px solid #dee2e6;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 899;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Always hidden by default, show when active */
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s ease;
}

/* Show when active class is added by JavaScript */
.citation-library-sidebar.active {
  transform: translateX(0);
  visibility: visible;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
}

.citation-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: linear-gradient(135deg, #6c5ce7 0%, #5f27cd 100%);
  border-bottom: 2px solid #4834d4;
  flex-shrink: 0;
}

.citation-sidebar-title {
  color: white;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

.citation-sidebar-header .citation-refresh-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  padding: 6px 10px !important;
  font-size: 14px !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.citation-sidebar-header .citation-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.05);
}

.citation-sidebar-actions {
  padding: 15px;
  background: white;
  border-bottom: 1px solid #dee2e6;
  flex-shrink: 0;
}

.btn-add-citation {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #6c5ce7 0%, #5f27cd 100%);
  border: none;
  border-bottom: 2px solid #4834d4;
  color: white;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}

.btn-add-citation:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.4);
}

.citation-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  background: white;
}

.citation-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.citation-empty-state p:first-child {
  font-size: 48px;
  margin: 0 0 10px 0;
}

.citation-empty-state p {
  margin: 5px 0;
  font-size: 14px;
}

.citation-hint {
  font-size: 12px !important;
  color: #adb5bd !important;
}

.citation-loading {
  padding: 10px 15px;
  background: #e7f3ff;
  border-top: 1px solid #6c5ce7;
  text-align: center;
  font-size: 12px;
  color: #4834d4;
  flex-shrink: 0;
}

/* Citation card in list */
.citation-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.citation-card:hover {
  background: #e9ecef;
  border-color: #6c5ce7;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.2);
  transform: translateY(-1px);
}

.citation-card-author {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
  font-size: 14px;
}

.citation-card-title {
  color: #666;
  font-size: 13px;
  margin-bottom: 4px;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.citation-card-meta {
  color: #999;
  font-size: 11px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.citation-card-year {
  font-weight: 500;
}

.citation-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #dee2e6;
}

.citation-card-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.citation-card-btn-insert {
  background: #6c5ce7;
  color: white;
}

.citation-card-btn-insert:hover {
  background: #5f27cd;
  transform: translateY(-1px);
}

.citation-card-btn-edit {
  background: #ffc107;
  color: #333;
}

.citation-card-btn-edit:hover {
  background: #ffb300;
  transform: translateY(-1px);
}

.citation-card-btn-delete {
  background: #dc3545;
  color: white;
}

.citation-card-btn-delete:hover {
  background: #c82333;
  transform: translateY(-1px);
}

/* ============================================
   CITATION FORM MODAL
   ============================================ */

.citation-form-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-in-out;
}

.citation-form-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

.citation-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 2px solid #e0e0e0;
  background: linear-gradient(135deg, #6c5ce7 0%, #5f27cd 100%);
  border-radius: 12px 12px 0 0;
}

.citation-form-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: white;
}

.citation-form-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 28px;
  color: white;
  cursor: pointer;
  padding: 4px 12px;
  line-height: 1;
  border-radius: 6px;
  transition: all 0.2s;
}

.citation-form-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.citation-form-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.citation-form-body .form-group {
  margin-bottom: 20px;
}

.citation-form-body .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.citation-form-body label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
  font-size: 14px;
}

.citation-form-body input,
.citation-form-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: border-color 0.2s;
}

.citation-form-body input:focus,
.citation-form-body textarea:focus {
  outline: none;
  border-color: #6c5ce7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.citation-form-body textarea {
  resize: vertical;
  min-height: 80px;
}

.citation-form-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.citation-form-footer .btn-cancel,
.citation-form-footer .btn-save {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.citation-form-footer .btn-cancel {
  background: #f3f4f6;
  color: #4b5563;
}

.citation-form-footer .btn-cancel:hover {
  background: #e5e7eb;
}

.citation-form-footer .btn-save {
  background: linear-gradient(135deg, #6c5ce7 0%, #5f27cd 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.citation-form-footer .btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .citation-form-modal {
    width: 95%;
    max-height: 95vh;
  }
  
  .citation-form-header,
  .citation-form-body {
    padding: 16px;
  }

  .citation-form-body .form-row {
    grid-template-columns: 1fr;
  }

  .citation-form-footer {
    flex-direction: column;
  }

  .citation-form-footer .btn-cancel,
  .citation-form-footer .btn-save {
    width: 100%;
  }
}

/* =========================================
   CSS STYLE BUILDER CONFIRMATION MESSAGES
   ========================================= */

/* Confirmation message popup styles */
.css-builder-confirmation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 30px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border-radius: 12px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(40, 167, 69, 0.4);
  animation: scaleIn 0.3s ease-out;
  max-width: 90%;
  text-align: center;
}

.confirmation-icon {
  font-size: 1.5em;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.2);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.confirmation-text {
  font-size: 0.95em;
}

.css-builder-confirmation.fade-out {
  animation: scaleOut 0.3s ease-out forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
}

