* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f7f7f7;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
header {
  background: #4e2a76;
  color: white;
  padding: 0px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
  justify-content: flex-start;
}

.header-title {
  font-size: 1.5rem;
  font-weight: bold;
}

.header-title img {
  width: auto;
  height: 50px;
}

.document-name-container {
  display: flex;
  align-items: center;
  margin-right: 15px;
}

.document-name-field {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: white;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  padding: 8px 12px;
  width: 280px;
  box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.2),
        0 0 8px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.document-name-field:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.document-name-field::placeholder {
  color: rgba(255, 255, 255, 0.6);
}


.action-buttons {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Main action buttons (existing style) */
.action-button {
  background-color: #4e2a76;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: white;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-button:hover {
  background: rgba(255,255,255,0.1);
}

/* Document storage buttons */
.storage-button {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  color: white;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 10px;
  display: flex;
  align-items: center;
}

.storage-button:hover {
  background: rgba(255,255,255,0.25);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Icons for storage buttons */
.storage-button-icon {
  margin-right: 6px;
  display: inline-flex;
}

.storage-buttons {
  display: flex;
  margin-right: 15px;
  border-right: 1px solid rgba(255,255,255,0.2);
  padding-right: 15px;
}

#newDocBtn {
  order: -1; 
}

.format-toolbar {
  background: white;
  padding: 5px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between; 
  align-items: center;
}

/* Left side of toolbar */
.left-toolbar {
  display: flex;
  align-items: center;
}

/* Combined tools container - right side */
.tools-container {
  display: flex;
  align-items: center;
  margin-left: auto; /* Push to the right */
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Format group - buttons grouping */
.format-group {
  display: flex;
  gap: 8px;
  padding-right: 15px;
}

.format-group:not(:last-child) {
  border-right: 1px solid #eee;
}

/* Special toolbar section */
.special-toolbar {
  display: flex;
  align-items: center;
  padding-right: 15px;
  border-right: 1px solid #eee;
}

/* Right toolbar section */
.right-toolbar {
  display: flex;
  align-items: center;
}

/* Format buttons */
.format-button {
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.format-button:hover {
  background: #f5f5f5;
}

.format-button.active {
  background: #4e2a76;
  color: white;
  border-color: #4e2a76;
}

/* Special tool buttons */
.special-tool-btn {
  font-size: 16px;
  background: transparent;
  color: #555;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.special-tool-btn:hover {
  color: #4e2a76;
  background-color: #f5f5f5;
}

.special-tool-btn.active {
  color: white;
  background-color: #4e2a76;
}

.right-toolbar .format-button {
  border: 1px solid #4e2a76;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.format-group {
  display: flex;
  gap: 8px;
  padding-right: 15px;
}

.format-group:not(:last-child) {
  border-right: 1px solid #eee;
}

.left-toolbar {
  display: flex;
  align-items: center;
}

.right-toolbar {
  display: flex;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.right-toolbar .format-button {
  border: 1px solid #4e2a76;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.format-button {
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.format-button:hover {
  background: #f5f5f5;
}

.format-button.active {
  background: #4e2a76;
  color: white;
  border-color: #4e2a76;
}

/* Document Area */
.document-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 10px;
  display: flex;
  justify-content: center;
}

.pages-container {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.document-page {
  background: white;
  width: 210mm;
  min-height: 297mm;
  padding: 20mm 15mm;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
}

.page-number {
  position: absolute;
  bottom: 10mm;
  right: 10mm;
  color: #666;
  font-size: 12px;
}

/* Animation for new pages */
@keyframes newPageFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.document-page.new-page {
  animation: newPageFadeIn 0.3s ease-out forwards;
}

.page-remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.2s ease;
  z-index: 100;
  color: #666;
  font-size: 16px;
}

.document-page:hover .page-remove-btn {
  opacity: 0.8;
}

.page-remove-btn:hover {
  opacity: 1 !important;
  background-color: #f0f0f0;
  color: #e74c3c;
}

/* Make sure the button is hidden for the first page */
.document-page:first-child .page-remove-btn {
  display: none;
}

/* Hide during printing */
@media print {
  .page-remove-btn {
    display: none !important;
  }
}

/* Confirmation dialog styles */
.page-remove-confirm {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 15px;
  z-index: 1001;
  width: 300px;
  text-align: center;
}

.page-remove-confirm p {
  margin: 0 0 15px 0;
  color: #333;
}

.page-remove-confirm-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.page-remove-confirm-btns button {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.page-remove-confirm-btns .cancel {
  background-color: #f0f0f0;
  color: #333;
}

.page-remove-confirm-btns .confirm {
  background-color: #e74c3c;
  color: white;
}

.page-remove-confirm-btns .cancel:hover {
  background-color: #e0e0e0;
}

.page-remove-confirm-btns .confirm:hover {
  background-color: #c0392b;
}

.page-number.updating {
  animation: page-number-update 0.5s ease;
}

@keyframes page-number-update {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Improve visual feedback when moving content */
.block-container.moving {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

/* Content Blocks */
.block-container {
  position: relative;
  margin-bottom: 0;
}

/* Add block buttons */
.add-block-buttons {
  position: absolute;
  left: -40px;
  top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.block-container:hover .add-block-buttons {
  opacity: 1;
}

.add-block-button {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.add-block-button:hover {
  background: #f5f5f5;
  border-color: #4e2a76;
  color: #4e2a76;
}

/* Text Block */
.text-block {
  width: 100%;
  min-height: 28px;
  border: none;
  padding: 4px 0;
  margin-top: 0;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.5;
  background: transparent;
}

.text-block:focus {
  outline: none;
  background: #f9f9ff;
}

/* Rich Text Styling */
.text-block h1 {
  font-size: 1.8em;
  margin: 0.5em 0;
}

.text-block h2 {
  font-size: 1.5em;
  margin: 0.5em 0;
}

.text-block h3 {
  font-size: 1.3em;
  margin: 0.5em 0;
}

.text-block p {
  margin: 12px 0;
}

/* ML Block */
.ml-block {
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 12px;
  margin: 0;
  position: relative;
}

.ML__content {
  display: flex;
  align-items: center;
  align-self: center;
  position: relative;
  overflow: hidden;
  padding: 2px 3px 2px 1px;
  width: 100%;
  isolation: isolate;
  font-family: 'Times New Roman', sans-serif;
  font-size: 18px;
}
.ml-block:focus-within {
  border-color: #4e2a76;
}

.ml-block math-field {
  width: 100%;
  border: none;
  --selection-background-color: #e3d9ff;
  --contains-highlight-background-color: #f0ebff;
}

.ml-block math-field:focus {
  outline: none;
}

.ml-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ml-block:focus-within .ml-controls {
  opacity: 1;
}
/* MathLive Field Styling */
math-field {
  width: 100%;
  min-height: 40px;
  padding: 8px 0;
  border: 1px solid #fff;
  border-radius: 4px;
  background-color: white;
  font-size: 18px;
  line-height: 1.5;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus state */
math-field:focus {
  outline: none;
  border-color: #4e2a76;
  box-shadow: 0 0 0 3px rgba(78, 42, 118, 0.1);
}

/* Customize MathLive colors */
math-field {
  --selection-background-color: rgba(78, 42, 118, 0.2);
  --contains-highlight-background-color: rgba(78, 42, 118, 0.08);
  --primary-color: #4e2a76;
  --caret-color: #4e2a76;
  --text-font-family: , 'Helvetica', sans-serif;
}

/* Make text more readable */
math-field .ML__container {
  font-size: 1.1em;
}

/* Fix the spacing for fractions and operators */
math-field .ML__fraction {
  padding: 0.2em 0;
}

math-field .ML__operator {
  margin: 0 0.15em;
}

/* Ensure ML blocks are visually distinct */
.ml-block {
  background-color: #fff;
}

/* Read-only math fields */
math-field[read-only="true"] {
  background-color: #f5f5f5;
  border-color: #e0e0e0;
  cursor: default;
}

/* Within response containers */
.response-container math-field {
  border-color: #4CAF50;
  background-color: rgba(76, 175, 80, 0.03);
}

.response-container math-field:focus {
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.add-text-after {
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ml-block:focus-within .add-text-after,
.image-block:focus-within .add-text-after,
.image-block.selected .add-text-after {
  opacity: 1;
}

.mathjax-math {
  display: inline;
  font-size: 17px;
}

.add-text-after:hover {
  background: #f0f0f0;
  border-color: #4e2a76;
  color: #4e2a76;
}

/* Image Block */
.image-block {
  border: 0px solid #eee;
  border-radius: 4px;
  padding: 8px;
  position: relative;
  display: inline-block;
  min-width: 100px;
  min-height: 100px;
  resize: both;
}

.image-block:focus-within,
.image-block.selected {
  border-color: #4e2a76;
}

.image-block img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.image-block:hover .image-controls,
.image-block:focus-within .image-controls,
.image-block.selected .image-controls {
  opacity: 1;
}

.control-button {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 12px;
}

.control-button:hover {
  background: #f0f0f0;
  border-color: #4e2a76;
  color: #4e2a76;
}

.image-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border: 1px solid #4e2a76;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.image-block:hover .image-resize-handle,
.image-block:focus-within .image-resize-handle,
.image-block.selected .image-resize-handle {
  opacity: 1;
}

.image-resize-handle.top-left { top: -5px; left: -5px; cursor: nw-resize; }
.image-resize-handle.top-right { top: -5px; right: -5px; cursor: ne-resize; }
.image-resize-handle.bottom-left { bottom: -5px; left: -5px; cursor: sw-resize; }
.image-resize-handle.bottom-right { bottom: -5px; right: -5px; cursor: se-resize; }

/* Notification */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  background: #4e2a76;
  font-size: 14px;
  color: white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: opacity 0.3s ease;
  opacity: 0;
  z-index: 1000;
}

.notification.show {
  opacity: 1;
}

/* Formula Popup Styles */
.formula-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 1010;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.formula-popup.show {
  display: flex;
}

.formula-popup-header {
  padding: 15px 20px;
  background: #f7f7f7;
  color: #4e2a76;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.formula-popup-close {
  background: transparent;
  border: none;
  color: #4e2a76;
  font-size: 20px;
  cursor: pointer;
}

.formula-popup-search {
  padding: 10px 20px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.formula-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.formula-popup-categories {
  display: flex;
  gap: 10px;
  padding: 10px 20px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  overflow-x: auto;
}

.formula-category {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.formula-category.active {
  background: #4e2a76;
  color: white;
  border-color: #4e2a76;
}

.formula-popup-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

.formula-item {
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.formula-item:hover {
  border-color: #4e2a76;
  background: #f9f9ff;
}

.formula-item math-field {
  pointer-events: none;
  margin-bottom: 8px;
}

.formula-item-caption {
  font-size: 12px;
  color: #666;
}

.formula-popup-footer {
  padding: 12px 20px;
  background: #f5f5f5;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #ddd;
}

/* Background overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
}

.overlay.show {
  display: block;
}

/* Formula info panel */
.formula-info {
  display: none;
  padding: 15px;
  background: #f9f9ff;
  border-left: 4px solid #4e2a76;
  margin-top: 15px;
}

.formula-info.show {
  display: block;
}

.formula-help-title {
  font-weight: bold;
  margin-bottom: 8px;
}

.formula-help-content {
  font-size: 14px;
  line-height: 1.5;
}

/* Document list styles */
.document-list {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.document-list th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid #4e2a76;
  color: #4e2a76;
}

.document-list td {
  padding: 12px 10px;
  border-bottom: 1px solid #eee;
}

.document-list tr:hover {
  background-color: #f9f9ff;
}

.document-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.open-btn, .delete-btn {
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid;
  transition: all 0.2s ease;
}

.open-btn {
  background: #4e2a76;
  color: white;
  border-color: #4e2a76;
}

.open-btn:hover {
  background: #3d2160;
}

.delete-btn {
  background: #ff6b6b;
  color: white;
  border-color: #ff6b6b;
}

.delete-btn:hover {
  background: #ff5252;
}

/* Auto-save indicator */
.auto-save-indicator {
  position: fixed;
  bottom: 10px;
  left: 10px;
  padding: 8px 12px;
  background: rgba(78, 42, 118, 0.1);
  border: 1px solid rgba(78, 42, 118, 0.2);
  border-radius: 4px;
  color: #4e2a76;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.auto-save-indicator.show {
  opacity: 1;
}

.calculator-container {
  position: fixed;
  bottom: 10px;
  right: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Calculator iframe */
#calculatorFrame {
  width: 600px;
  height: 520px;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  background: white;
  margin-bottom: 0px;
  display: none;
  transform-origin: bottom right;
  animation: popup 0.3s ease-out forwards;
}

@keyframes popup {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#calculatorFrame.show {
  display: block;
}

/* Calculator Bubble */
.calculator-bubble {
  width: 50px;
  height: 50px;
  background: linear-gradient(145deg, #001f3f, #0a4f70);
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  font-weight: bolder;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.calculator-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.calculator-bubble:active {
  transform: scale(0.95);
}

/* Calculator Icon */
.calc-icon {
  width: 24px;
  height: 24px;
  position: relative;
}

.calc-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-radius: 2px;
}

.calc-icon::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 5px;
  width: 14px;
  height: 10px;
  background: transparent;
  box-shadow: 
    0 0 0 2px white,
    0 6px 0 2px white,
    7px 0 0 2px white,
    7px 6px 0 2px white;
}

/* Authentication Lightbox */
.auth-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-lightbox.hidden {
  display: none;
}

.auth-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.auth-header {
  background-color: #f7f7f7;
  color: #4e2a76;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.auth-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close-button {
  background: transparent;
  border: none;
  color: #4e2a76;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.auth-form {
  padding: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.form-group input[type="file"] {
  padding: 8px;
}

.action-button:hover {
  background-color: #3b1f5a;
}

.toggle-auth {
  text-align: center;
  padding: 15px;
  color: #4e2a76;
  cursor: pointer;
  font-size: 14px;
}

.toggle-auth:hover {
  text-decoration: underline;
}

/* Auth Controls in Header */
.auth-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #f0f0f0;
}

.auth-button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: white;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.auth-button:hover {
  background: rgba(255,255,255,0.1);
}

button[type="button"],
button[type="submit"],
input[type="button"],
input[type="submit"] {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Fix any specific form submit buttons that might be hidden */
.auth-form button {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}
/* Notification */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: opacity 0.3s ease;
  opacity: 0;
  z-index: 1000;
}

.notification.show {
  opacity: 1;
}

.notification.success {
  background: #4e2a76;
  color: white;
}

.notification.error {
  background: #ff4757;
  color: white;
  font-size: 14px;
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* Styling for share button */
#shareBtn {
  background: #ed1566;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

#shareBtn:hover {
  background: #5b2a97;
}

/* Shared documents button */
#sharedDocsBtn {
  position: relative;
}

/* Styling for share dialog */
.share-dialog {
  width: 500px;
  max-width: 90vw;
}

.share-url-container {
  display: flex;
  background: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #ddd;
  overflow: hidden;
  margin-bottom: 16px;
}

.share-url-input {
  flex: 1;
  border: none;
  padding: 8px 12px;
  background: transparent;
}

.share-url-input:focus {
  outline: none;
}

.share-url-copy {
  background: #4e2a76;
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.share-url-copy:hover {
  background: #3d2160;
}

/* Shared documents list */
.shared-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 16px;
}

.shared-tab {
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.shared-tab.active {
  border-bottom: 2px solid #4e2a76;
  color: #4e2a76;
  font-weight: bold;
}

/* Shared document action buttons */
.copy-link, .delete-share {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid;
  margin-right: 4px;
}

.copy-link {
  background: #4e2a76;
  color: white;
  border-color: #4e2a76;
}

.copy-link:hover {
  background: #3d2160;
}

.delete-share {
  background: #ff6b6b;
  color: white;
  border-color: #ff6b6b;
}

.delete-share:hover {
  background: #ff5252;
}

.share-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 20px;
}

.share-tab {
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.share-tab:hover {
  background-color: #f9f9f9;
}

.share-tab.active {
  border-bottom: 2px solid #4e2a76;
  color: #4e2a76;
  font-weight: bold;
}

/* Share tab content */
.share-tab-content {
  display: none;
}

.share-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Share URL input container */
.share-url-container {
  display: flex;
  background: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #ddd;
  overflow: hidden;
  margin-bottom: 16px;
}

.share-url-input {
  flex: 1;
  border: none;
  padding: 8px 12px;
  background: transparent;
}

.share-url-input:focus {
  outline: none;
}

.share-url-copy {
  background: #4e2a76;
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.share-url-copy:hover {
  background: #3d2160;
}

/* Field styles */
.share-field {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
}

.share-field:focus {
  outline: none;
  border-color: #4e2a76;
  box-shadow: 0 0 0 2px rgba(78, 42, 118, 0.1);
}

.share-field-hint {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* Sharing actions button */
.share-action-button {
  background: #4e2a76;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  margin-top: 10px;
}

.share-action-button:hover {
  background: #3d2160;
}
/* View-only mode indicator */
.view-only-mode .document-page {
  position: relative;
}

.view-only-mode .document-page::before {
  content: 'View Only';
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(78, 42, 118, 0.1);
  color: #4e2a76;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.view-only-banner {
  animation: fadeIn 0.5s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

/* Add these styles to your CSS file for better banner styling */

.view-only-banner {
  background-color: #f7f7f7;
  color: #4e2a76;
  padding: 8px 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: normal;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: slideDown 0.3s ease;
  transition: all 0.3s ease;
}

.view-only-banner.closing {
  transform: translateY(-100%);
  opacity: 0;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.banner-close-btn {
  background: none;
  border: none;
  color: #4e2a76;
  cursor: pointer;
  font-size: 20px;
  padding: 0 4px;
  transition: transform 0.2s ease;
}

.banner-close-btn:hover {
  transform: scale(1.2);
}

/* Add a small "View Only" indicator in the top-right when banner is closed */
.view-only-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background-color: rgba(78, 42, 118, 0.8);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  z-index: 900;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(-10px);
  animation: fadeIn 0.3s ease forwards;
  animation-delay: 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.share-permissions-select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 8px;
}

/* New share Doc style */

.share-success-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 500px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  z-index: 1100;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.share-success-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: all;
}

.share-success-header {
  padding: 15px 20px;
  background: #f7f7f7;
  color: #4e2a76;
  font-weight: bold;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.share-success-close {
  background: transparent;
  border: none;
  color: #4e2a76;
  font-size: 20px;
  cursor: pointer;
}

.share-success-content {
  padding: 20px;
}

.share-url-container {
  display: flex;
  margin: 15px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.share-url-container input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
  font-size: 14px;
}

.share-url-container button {
  padding: 10px 15px;
  background: #4e2a76;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s ease;
}

.share-url-container button:hover {
  background: #3d2160;
}

.share-tip {
  font-size: 13px;
  color: #666;
  margin-top: 10px;
  font-style: italic;
}

/* Sync indicator banner styles */
.sync-status-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #4e2a76;
  color: white;
  padding: 10px 20px;
  z-index: 10000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: slide-down 0.3s ease-out;
}

.sync-status-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-status-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

@keyframes slide-down {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* Spinning animation for sync icon */
.fa-spin {
  animation: fa-spin 2s infinite linear;
}

@keyframes fa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Button styles within the sync banner */
.sync-status-banner .action-button {
  background: white;
  color: #4e2a76;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.sync-status-banner .action-button:hover {
  background: #f0f0f0;
}

.sync-status-banner .action-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.sync-operations-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9em;
  max-height: 100px;
  overflow-y: auto;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.sync-operation-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

/* Animation for banner closing */
.sync-banner-closing {
  animation: slide-up 0.3s ease-out forwards;
}

@keyframes slide-up {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0; }
}
/* Document sharing CSS additions */
.share-form .form-group {
  margin-bottom: 20px;
}

.share-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
}

.share-form input,
.share-form select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.share-form select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
}

/* Offline user info */
.offline-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px;
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  margin-bottom: 20px;
  border-radius: 4px;
}

.offline-info i {
  font-size: 18px;
  color: #856404;
}

.offline-info p {
  font-size: 14px;
  color: #856404;
  margin: 0;
}

/* Animation for sync icon */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fa-spin {
  animation: spin 1.5s linear infinite;
}

/* Additional styles for document list view */
.document-list thead th {
  position: sticky;
  top: 0;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 1;
  padding: 12px 10px;
}

.document-list td {
  vertical-align: middle;
  padding: 12px 10px;
}

/* Improve document cards appearance */
.document-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.document-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  border-color: #4e2a76;
}

.document-card-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: #4e2a76;
  margin-bottom: 12px;
  padding-right: 24px; /* Space for sync icon */
}

/* End new doc styles */

.special-toolbar {
  display: flex;
  align-items: center;
  margin-right: 15px;
  padding-right: 15px;
  border-right: 1px solid #eee;
}

/* Special tool buttons */
.special-tool-btn {
  font-size: 16px;
  background: transparent;
  color: #555;
  transition: all 0.2s ease;
}

.special-tool-btn:hover {
  color: #4e2a76;
  background-color: #f5f5f5;
}

.special-tool-btn.active {
  color: white;
  background-color: #4e2a76;
}

/* Iframe container */
.iframe-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Iframe header */
.iframe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #4e2a76;
  color: white;
  padding: 10px 20px;
}

.iframe-title {
  font-size: 18px;
  font-weight: bold;
}

.iframe-close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.iframe-close-btn:hover {
  transform: scale(1.2);
}

/* Iframe itself */
.tool-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
}

/* Body with active iframe */
body.iframe-active {
  overflow: hidden;
}

.teacher-selection-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 10px;
}

.teacher-item {
  padding: 8px 12px;
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid #eee;
}

.teacher-item:last-child {
  border-bottom: none;
}

.teacher-item input[type="checkbox"] {
  margin-right: 10px;
  margin-top: 5px;
}

.teacher-name {
  font-weight: 500;
}

.teacher-role {
  font-size: 12px;
  color: #4e2a76;
  margin-top: 2px;
}

.teacher-subject {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}

.points-label {
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 14px;
  font-weight: bold;
  color: #4e2a76;
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0);
  padding: 3px 5px;
  border-radius: 4px;
  z-index: 5;
}

/* Fix task controls positioning */
.task-controls {
  position: absolute !important;
  top: 5px !important;
  right: 120px !important; /* Move further left to avoid overlap */
  display: flex !important;
  gap: 5px !important;
  background-color: rgba(255, 255, 255, 0);
  padding: 3px;
  border-radius: 4px;
  z-index: 5;
}

/* Assessment modal layout fixes */
.assessment-modal {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden; /* Prevents double scrollbars */
}

.assessment-modal-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.assessment-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  max-height: calc(90vh - 140px); /* Adjust based on header and footer height */
}

.assessment-modal-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: white;
  z-index: 10;
  border-top: 1px solid #ddd;
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form control styling */
.form-select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  box-sizing: border-box;
}

.form-select:focus {
  outline: none;
  border-color: #4e2a76;
  box-shadow: 0 0 0 2px rgba(78, 42, 118, 0.2);
}

.form-select option {
  padding: 8px;
}

/* Improved form groups */
.assessment-form-group {
  margin-bottom: 20px;
}

.assessment-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.assessment-form-group input[type="text"],
.assessment-form-group input[type="datetime-local"],
.assessment-form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

.assessment-form-group input:focus,
.assessment-form-group textarea:focus {
  outline: none;
  border-color: #4e2a76;
  box-shadow: 0 0 0 2px rgba(78, 42, 118, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .assessment-modal-body {
    padding: 15px;
    max-height: calc(90vh - 120px);
  }
  
  .assessment-form-group {
    margin-bottom: 15px;
  }
  
  .form-select,
  .assessment-form-group input,
  .assessment-form-group textarea {
    padding: 8px;
    font-size: 13px;
    font-family: 'Segoe UI', sans-serif;
  }
}

.assessment-modal {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.assessment-modal-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.assessment-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  max-height: calc(90vh - 130px); /* Adjust based on header and footer height */
}

.assessment-modal-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: white;
  z-index: 1;
  border-top: 1px solid #ddd;
}

/* Improved form controls */
.form-select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
}

.assessment-form-group {
  margin-bottom: 20px;
}

.assessment-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.assessment-image-container {
  position: absolute;
  z-index: 5;
  margin: 0;
  box-sizing: border-box;
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

/* Selected state styling */
.assessment-image-container.selected {
  box-shadow: 0 0 0 2px rgba(78, 42, 118, 0.5);
  z-index: 10;
}

/* Image element styling */
.assessment-image {
  max-width: 100%;
  display: block;
  cursor: move;
  border-radius: 4px;
}

/* Resize handles - only visible when selected */
.assessment-image-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: white;
  border: 2px solid #673AB7;
  border-radius: 50%;
  z-index: 11;
  cursor: pointer;
  display: none; /* Hidden by default, shown when selected */
}

/* Handle positioning */
.assessment-image-resize-handle.top-left {
  top: -5px;
  left: -5px;
  cursor: nw-resize;
}

.assessment-image-resize-handle.top-right {
  top: -5px;
  right: -5px;
  cursor: ne-resize;
}

.assessment-image-resize-handle.bottom-left {
  bottom: -5px;
  left: -5px;
  cursor: sw-resize;
}

.assessment-image-resize-handle.bottom-right {
  bottom: -5px;
  right: -5px;
  cursor: se-resize;
}

/* Controls visible on hover and selection */
.assessment-image-controls {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  padding: 3px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.assessment-image-container:hover .assessment-image-controls,
.assessment-image-container.selected .assessment-image-controls {
  opacity: 1;
}
.task-points {
  width: 50px; 
  text-align: center;
  height:30px;
}

.hidden-in-presentation {
  display: none !important;
}

body.presentation-mode .student-assessment-toolbar,
body.presentation-mode .assessment-toolbar {
  display: none !important;
}

.task-container, .question-group, .response-container {
  position: relative;
  min-height: 100px;
  transition: min-height 0.2s ease;
}

body.presentation-mode .document-page {
  /* Set 16:9 aspect ratio explicitly */
  aspect-ratio: 16/9 !important;
  width: 960px !important;
  max-width: min(80vw, calc(80vh * 16/9)) !important;
  height: 450px !important;
  
  /* Override any conflicting styles */
  min-height: unset !important;
  
  /* Keep other styling */
  padding: 0;
  margin: 30px auto;
  display: flex;
  flex-direction: column;
  background-color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

body.presentation-mode .page-content {
  flex: 1;
  position: relative;
  padding: 5%;
  overflow: hidden;
}

body.presentation-mode .text-block {
  font-size: 24px;
}

body.presentation-mode .text-block h1 {
  font-size: 48px;
}

body.presentation-mode .text-block h2 {
  font-size: 36px;
}

body.presentation-mode .text-block h3 {
  font-size: 30px;
}

body.presentation-mode .text-block p {
  margin-bottom: 16px;
}

body.presentation-mode .text-block ul,
body.presentation-mode .text-block ol {
  margin-left: 30px;
}

body.presentation-mode math-field {
  font-size: 28px;
}

body.presentation-mode .ml-block math-field {
  font-size: 28px;
}

/* Slide navigation controls */
.slide-controls {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  z-index: 100;
  padding: 10px;
  transition: opacity 0.3s ease;
}

.slide-controls.hidden {
  opacity: 0;
}

.slide-control-btn {
  background-color: #4e2a76;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.slide-control-btn:hover {
  background-color: #3d2160;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.slide-control-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.slide-control-btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.slide-indicator {
  font-size: 16px;
  color: #4e2a76;
  background-color: white;
  padding: 5px 15px;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.slide-thumbnail-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  overflow-x: auto;
  padding: 10px;
  gap: 10px;
  z-index: 90;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.slide-thumbnail-bar.show {
  transform: translateY(0);
}

.slide-thumbnail {
  height: 100px;
  aspect-ratio: 16/9;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  background-color: white;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.slide-thumbnail.active {
  border-color: #4e2a76;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.slide-thumbnail:hover {
  border-color: #4e2a76;
}

.slide-thumbnail-content {
  transform: scale(0.18);
  transform-origin: top left;
  width: 555.55%; /* 100% * (1/0.18) */
  height: 555.55%;
  pointer-events: none;
}

.slide-thumbnail-number {
  position: absolute;
  bottom: 2px;
  right: 5px;
  font-size: 12px;
  color: #666;
}

/* Present button */
.present-button {
  position: fixed;
  bottom: 80px;
  right: 30px;
  background-color: #4e2a76;
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  z-index: 150;
  transition: all 0.2s ease;
}

.present-button:hover {
  background-color: #3d2160;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.present-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Presentation tools */
.presentation-toolbar {
  position: fixed;
  top: 160px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.presentation-tool-btn {
  background-color: white;
  color: #4e2a76;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.presentation-tool-btn:hover {
  background-color: #f9f9f9;
  border-color: #4e2a76;
  transform: translateX(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.presentation-tool-btn:active {
  transform: translateX(0);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Slide template selector */
.slide-template-selector {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  padding: 20px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.slide-template-selector.show {
  display: block;
}

.slide-template-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.slide-template-selector-title {
  font-size: 24px;
  font-weight: 600;
  color: #4e2a76;
}

.slide-template-selector-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.slide-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.slide-template {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.slide-template:hover {
  border-color: #4e2a76;
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.slide-template-preview {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #666;
}

.slide-template-name {
  padding: 10px;
  text-align: center;
  font-weight: 500;
  border-top: 1px solid #eee;
}

/* Fullscreen presentation mode */
.fullscreen-presentation {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: black;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fullscreen-slide {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fullscreen-slide-content {
  width: 100%;
  height: 100%;
  max-width: 177.78vh; /* 16:9 aspect ratio */
  max-height: 56.25vw; /* 16:9 aspect ratio */
  background-color: white;
  position: relative;
}

.fullscreen-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1010;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-presentation:hover .fullscreen-controls {
  opacity: 1;
}

.fullscreen-control-btn {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.2s ease;
}

.fullscreen-control-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Exit button for fullscreen */
.exit-fullscreen {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.3);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 18px;
  z-index: 1010;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-presentation:hover .exit-fullscreen {
  opacity: 1;
}

/* Add slide button */
.add-slide-btn {
  background-color: #f0f0f0;
  border: 2px dashed #4e2a76;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 100%;
  height: 100%;
  transition: all 0.2s ease;
}

.add-slide-btn:hover {
  background-color: #f5f5f5;
  transform: scale(1.02);
}

.add-slide-btn i {
  font-size: 36px;
  color: #4e2a76;
  margin-bottom: 10px;
}

.add-slide-text {
  color: #4e2a76;
  font-weight: 500;
}

/* Slide layout customizations */
.slide-title-layout .page-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.slide-title-layout .text-block h1 {
  font-size: 60px;
  margin-bottom: 30px;
}

.slide-title-layout .text-block h2 {
  font-size: 36px;
  color: #666;
}

.slide-two-column-layout .page-content {
  display: flex;
  gap: 5%;
}

.slide-two-column-layout .column {
  flex: 1;
}

.slide-image-text-layout .page-content {
  display: flex;
  gap: 5%;
}

.slide-image-text-layout .image-side {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.slide-image-text-layout .text-side {
  flex: 1;
}

/* Theme selector */
.theme-selector {
  position: fixed;
  bottom: 20px;
  right: 90px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  padding: 10px;
  z-index: 100;
  display: none;
}

.theme-selector.show {
  display: block;
}

.theme-option {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.theme-option:hover {
  transform: scale(1.1);
}

.theme-option.active {
  border-color: #4e2a76;
}

/* Color themes */
body.theme-default .document-page {
  background-color: white;
  color: #333;
}

body.theme-dark .document-page {
  background-color: #2c2c2c;
  color: #fff;
}

body.theme-dark .text-block, 
body.theme-dark .text-block h1,
body.theme-dark .text-block h2,
body.theme-dark .text-block h3 {
  color: #fff;
}

body.theme-blue .document-page {
  background-color: #1a237e;
  color: #fff;
}

body.theme-blue .text-block, 
body.theme-blue .text-block h1,
body.theme-blue .text-block h2,
body.theme-blue .text-block h3 {
  color: #fff;
}

body.theme-gradient-purple .document-page {
  background: linear-gradient(135deg, #4527a0, #7b1fa2);
  color: #fff;
}

body.theme-gradient-purple .text-block, 
body.theme-gradient-purple .text-block h1,
body.theme-gradient-purple .text-block h2,
body.theme-gradient-purple .text-block h3 {
  color: #fff;
}

body.presentation-mode .document-page.slide {
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 Aspect Ratio (9 / 16 = 0.5625 or 56.25%) */
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  background-color: white;
  margin: 0 auto;
  max-width: 1200px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

body.presentation-mode .document-page.slide .page-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 20px;
  padding: 40px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Maintain 16:9 ratio when resizing window */
@media screen and (max-width: 1200px) {
  body.presentation-mode .document-page.slide {
    width: 90%;
  }
}

/* Adjust slides container for better centering */
body.presentation-mode .pages-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
}

/* Slide controls positioning for 16:9 */
body.presentation-mode .slide-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0);
  border-radius: 30px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Fullscreen presentation specific adjustments */
.fullscreen-presentation .fullscreen-slide-content {
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  position: relative;
  overflow: hidden;
}

.fullscreen-presentation .fullscreen-slide-content .page-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 60px;
}

/* Solution Sidebar Styles */
/* Solution Sidebar Styles */
.solution-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 480px;
  height: 100vh;
  background: white;
  border-left: 1px solid #ddd;
  box-shadow: -2px 0 10px rgba(0,0,0,0.1);
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.solution-sidebar.open {
  right: 0;
}
.solution-sidebar-header {
  padding: 15px;
  background: #4e2a76;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.solution-sidebar-header h3 {
  margin: 0;
  flex: 1;
}
.solution-visibility-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  width: 100%;
}
.solution-visibility-controls select {
  flex: 1;
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ddd;
}
.solution-visibility-selector {
  flex: 1;
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ddd;
}
.solution-sidebar-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}
.solution-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}
.solution-task-item {
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}
.solution-task-header {
  padding: 10px;
  background: #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.solution-task-content {
  padding: 15px;
  display: none;
}
.solution-task-content.open {
  display: block;
}
.solution-editor {
  margin-top: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-height: 100px;
  width: 100%;
  padding: 10px;
  background-color: #fff;
}
.solution-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.toggle-solution-math-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}
.solution-save-btn {
  background: #4e2a76;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
}
.solution-task-has-solution .solution-task-header {
  background: #e6f7ff;
  border-left: 3px solid #1890ff;
}
/* Task indicators in the main view */
.task-container .has-solution-indicator {
  position: absolute;
  top: 5px;
  right: 80px;
  background-color: #52c41a;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
}
/* Solution view button for students */
.view-solution-btn {
  display: block;
  margin: 10px auto 5px;
  background-color: #4e2a76;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.view-solution-btn:hover {
  background-color: #3d2160;
}
.solution-content {
  padding: 15px;
  background-color: #f9f9ff;
  border-radius: 8px;
  border-left: 4px solid #4e2a76;
}
.inline-math-wrapper {
  display: inline-block;
  vertical-align: middle;
  position: relative;
}

math-field.inline-math {
  display: inline-block;
  vertical-align: baseline;
  font-size: inherit;
  line-height: inherit;
}

/* Prevent formatting bleed */
.math-text {
  display: inline;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  color: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-decoration: inherit;
}

/* Format reset space */
.format-reset-space {
  display: inline;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  color: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-decoration: inherit;
}

/* Container for math content and space */
.math-container {
  display: inline;
}

.admin-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f5f5f5;
  z-index: 2000;
  display: flex;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.admin-panel.hidden {
  display: none;
}

.admin-sidebar {
  width: 250px;
  background: #4e2a76;
  color: white;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.admin-logo {
  display: flex;
  align-items: center;
  padding: 0 20px 20px;
  border-bottom: 3px solid #ed1566;
  margin-bottom: 20px;
  flex-direction: column;
}

.admin-logo img {
  width: auto;
  height: 40px;
  margin-right: 0px;
}

.admin-logo h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.admin-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-menu-item {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 14px;
  transition: background-color 0.2s;
}

.admin-menu-item:hover {
  background: rgba(255,255,255,0.1);
}

.admin-menu-item.active {
  background: rgba(255,255,255,0.2);
  font-weight: 500;
}

.admin-menu-item i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

.admin-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.admin-section-header h2 {
  margin: 0;
  font-size: 24px;
  color: #4e2a76;
}

.admin-controls {
  display: flex;
  gap: 10px;
}

.admin-controls select,
.admin-controls input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.refresh-btn {
  padding: 8px 15px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.refresh-btn:hover {
  background-color: #e0e0e0;
}

.approval-table,
.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.approval-table th,
.approval-table td,
.users-table th,
.users-table td {
  font-size: 14px;
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.approval-table th,
.users-table th {
  background-color: #f5f5f5;
  font-weight: 500;
  color: #333;
}

.approval-table tr:hover,
.users-table tr:hover {
  background-color: #f9f9f9;
}

.user-status {
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  text-align: center;
}

.user-status.pending {
  background-color: #FFF3CD;
  color: #856404;
}

.user-status.approved {
  background-color: #D4EDDA;
  color: #155724;
}

.user-status.rejected {
  background-color: #F8D7DA;
  color: #721C24;
}

/* Email styles*/

.email-container {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
}

@media (max-width: 992px) {
  .email-container {
    grid-template-columns: 1fr;
  }
}

.email-composer, .email-history {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 20px;
}

.email-composer h3, .email-history h3 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 20px;
  color: #4e2a76;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.filter-group {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.filter-group label {
  width: 80px;
  margin-bottom: 0;
  margin-right: 10px;
}

.filter-group select {
  flex: 1;
}

.recipient-preview {
  background-color: #f9f9f9;
  padding: 10px;
  border-radius: 4px;
  margin-top: 15px;
}

.recipients-count {
  margin-bottom: 10px;
  font-weight: 500;
}

.template-variables {
  margin: 15px 0;
  background-color: #f9f5ff;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #e3d4ff;
}

.template-variables p {
  margin-top: 15px;
  margin-bottom: 8px;
  font-size: 14px;
}

.template-variable {
  display: inline-block;
  background-color: #4e2a76;
  color: white;
  padding: 3px 8px;
  margin: 0 5px 5px 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.action-button {
  background-color: #4e2a76;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.action-button.secondary {
  background-color: #6c757d;
}

.action-button.small {
  padding: 5px 10px;
  font-size: 12px;
}

.email-list {
  max-height: 400px;
  overflow-y: auto;
}

.email-item {
  padding: 10px;
  border-bottom: 1px solid #ed1566;
  background-color: #f8f8f8;
}

.email-item:hover {
  background-color: #f9f9f9;
}

.email-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.email-subject {
  font-weight: 400;
}

.email-date {
  color: #6c757d;
  font-size: 12px;
}

.email-recipients {
  font-size: 12px;
  color: #6c757d;
}

/* Modal for recipient list */
.recipients-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
}

.recipients-modal-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

.recipients-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.recipients-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.recipients-list {
  max-height: 60vh;
  overflow-y: auto;
}

.recipient-item {
  padding: 8px;
  border-bottom: 1px solid #eee;
}

.recipient-item:last-child {
  border-bottom: none;
}

.email-content {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

/* Markdown styles */
h1, h2, h3, h4, h5, h6 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-weight: bold;
}

h1 { font-size: 1.8em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.3em; }

p { margin: 0.8em 0; }

ul, ol {
  margin: 0.8em 0;
  padding-left: 2em;
}

code {
  font-family: monospace;
  background-color: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre {
  background-color: #f5f5f5;
  padding: 1em;
  border-radius: 5px;
  overflow-x: auto;
}

blockquote {
  border-left: 4px solid #ddd;
  padding-left: 1em;
  color: #666;
  margin: 0.8em 0;
}

a {
  color: #4e2a76;
  text-decoration: underline;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

th, td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

th {
  background-color: #f2f2f2;
}

/* Math-related styles */
.math-block {
  overflow-x: auto;
  margin: 1em 0;
  padding: 0.5em 0;
}

.inline-math {
  vertical-align: middle;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e3e3e3;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #e3e3e3;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.email-preview-subject {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.email-preview-content {
  background-color: #f9f9f9;
  padding: 15px;
  border-radius: 5px;
  border: 1px solid #e3e3e3;
}

/* Ensure content in the preview is properly styled */
#previewContent {
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

#previewContent h1, 
#previewContent h2, 
#previewContent h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

#previewContent p {
  margin: 0.8em 0;
}

#previewContent ul, 
#previewContent ol {
  margin: 0.8em 0;
  padding-left: 2em;
}

#previewContent blockquote {
  border-left: 4px solid #ddd;
  padding: 0 15px;
  color: #666;
}

/* Math styles */
#previewContent .math-block {
  overflow-x: auto;
  margin: 1em 0;
  padding: 0.5em 0;
}

#previewContent .inline-math {
  vertical-align: middle;
}

/* Action buttons */

.action-buttons {
  display: flex;
  gap: 5px;
}

.action-button {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}

.action-button.approve {
  background-color: #4CAF50;
  color: white;
}

.action-button.approve:hover {
  background-color: #3e8e41;
}

.action-button.reject {
  background-color: #F44336;
  color: white;
}

.action-button.reject:hover {
  background-color: #d32f2f;
}

.action-button.view {
  background-color: #2196F3;
  color: white;
}

.action-button.view:hover {
  background-color: #0b7dda;
}

.loading-row td {
  text-align: center;
  padding: 30px;
}

.loading-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(78, 42, 118, 0.3);
  border-radius: 50%;
  border-top-color: #4e2a76;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.settings-group {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-group h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #4e2a76;
  font-size: 18px;
  font-weight: 500;
}

.setting-item {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  margin-right: 15px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #4e2a76;
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.domain-list, .admin-list {
  background: #f9f9f9;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 15px;
  max-height: 200px;
  overflow-y: auto;
}

.domain-item, .admin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: white;
  border-radius: 4px;
  margin-bottom: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.remove-domain, .remove-admin {
  background: none;
  border: none;
  color: #F44336;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}

.add-domain, .add-admin {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.add-domain input, .add-admin input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.add-domain button, .add-admin button, .primary-button {
  padding: 8px 15px;
  background-color: #4e2a76;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.add-domain button:hover, .add-admin button:hover, .primary-button:hover {
  background-color: #3d2160;
}

.settings-actions {
  text-align: right;
  margin-top: 20px;
}

/* Reject Reason Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.modal-container {
  background-color: white;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: #4e2a76;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #ddd;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-body textarea {
  width: 100%;
  height: 120px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
}

.cancel-button {
  padding: 8px 15px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.cancel-button:hover {
  background-color: #e0e0e0;
}
.admin-access-button {
  background-color: #4e2a76;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 10px;
  margin-right: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  flex-direction: column;
  transition: background-color 0.2s;
}

span.cursor-indented {
  display: inline-block;
  vertical-align: top;
  word-break: normal;
  word-wrap: break-word;
  position: relative;
}

/* Keep the cursor and text separate with CSS */
span.cursor-indented:after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
}

/* Keep text on the line it started on */
span.before-cursor {
  white-space: nowrap;
  display: inline;
}

/* Prevent text blocks from overflowing */
.text-block {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Improve selection visibility */
span.cursor-indented::selection,
span.cursor-indented *::selection {
  background-color: rgba(78, 42, 118, 0.2);
}

.table-block {
  position: relative;
  margin: 1em 0;
  overflow-x: auto;
}

/* Core table styles */
.sigma-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: inherit;
  font-family: inherit;
  margin: 0;
}

.sigma-table th,
.sigma-table td {
  padding: 8px;
  text-align: left;
  vertical-align: top;
  min-width: 80px;
  position: relative;
}

.sigma-table th {
  font-weight: bold;
  background-color: #f4f4f4;
}

.sigma-table th {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.sigma-table th::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  transition: transform 0.2s;
  opacity: 0;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.sigma-table th:hover::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid #aaa;
  opacity: 0.5;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.sigma-table th.sorted-asc::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid #666;
  opacity: 1;
  transform: translateY(-50%);
}

.sigma-table th.sorted-desc::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #666;
  border-bottom: 0;
  opacity: 1;
  transform: translateY(-50%);
}

.sigma-table [rowspan], .sigma-table [colspan] {
  background-color: #fafafa;
  border: 1px solid #ddd;
}

.sigma-table td:empty::after {
  content: "\\200b"; /* Zero-width space to maintain height */
}

/* Focus styling */
.sigma-table th:focus,
.sigma-table td:focus {
  outline: 2px solid #4e2a76;
  outline-offset: -2px;
  z-index: 1;
}

/* Table style: default */
.sigma-table.default th {
  border-bottom: 2px solid #ddd;
}

.sigma-table.default td {
  border-bottom: 1px solid #ddd;
}

/* Table style: bordered */
.sigma-table.bordered th,
.sigma-table.bordered td {
  border: 1px solid #ddd;
}

/* Table style: striped */
.sigma-table.striped tbody tr:nth-child(odd) {
  background-color: #f9f9f9;
}

/* Table style: minimal */
.sigma-table.minimal th {
  border-bottom: 1px solid #ddd;
  font-weight: normal;
  font-style: italic;
  background: transparent;
}

.sigma-table.minimal td {
  border: none;
  border-bottom: 1px dotted #eee;
}

/* Table alignment */
.sigma-table.align-left {
  margin-right: auto;
  margin-left: 0;
}

.sigma-table.align-center {
  margin-left: auto;
  margin-right: auto;
}

.sigma-table.align-right {
  margin-left: auto;
  margin-right: 0;
}

/* Table padding */
.sigma-table.compact th,
.sigma-table.compact td {
  padding: 4px;
}

.sigma-table.normal th,
.sigma-table.normal td {
  padding: 8px;
}

.sigma-table.loose th,
.sigma-table.loose td {
  padding: 12px;
}

/* Table controls */
.table-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Show controls on hover */
.table-block:hover .table-controls {
  opacity: 1;
}

.table-controls .control-button {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.table-controls .control-button:hover {
  background-color: #e0e0e0;
}

/* Add text after button */
.table-block .add-text-after {
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.table-block:hover .add-text-after {
  opacity: 1;
}

/* Print styles */
@media print {
  .sigma-table {
    break-inside: avoid;
  }
  
  .table-controls,
  .add-text-after {
    display: none !important;
  }
}

.zoom-controls {
  display: flex;
  align-items: center;
  margin-left: 10px;
  background: white;
  border-radius: 4px;
  padding: 2px 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.zoom-btn {
  background: transparent;
  border: none;
  color: #4e2a76;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.zoom-btn:hover {
  background-color: rgba(78, 42, 118, 0.1);
}

.zoom-level {
  margin: 0 6px;
  font-size: 14px;
  min-width: 45px;
  text-align: center;
  color: #333;
  user-select: none;
}

.reset-zoom {
  font-size: 12px;
  padding: 0 6px;
  margin-left: 4px;
  width: auto;
  height: 24px;
  background-color: #f1f1f1;
  color: #666;
}

.reset-zoom:hover {
  background-color: #e0e0e0;
}

/* Transition for smooth zooming */
.document-page {
  transition: transform 0.2s ease-out;
}

/* Focus highlighting for the zoomed page */
.document-page.zoom-active {
  box-shadow: 0 0 0 2px rgba(78, 42, 118, 0.3);
}

/* Ensure math and images scale properly */
.document-page[style*="scale"] .mathjax-math mjx-container,
.document-page[style*="scale"] math-field,
.document-page[style*="scale"] .image-block img {
  transform-origin: left top;
}

/* Make zoom controls responsive */
@media (max-width: 768px) {
  .zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 24px;
  }
}

/* Hide in print mode */
@media print {
  .zoom-controls {
    display: none !important;
  }
}

.sheets-sync-btn {
  margin-right: 10px;
  background-color: #4e2a76;
  color: #4285F4;
  border: none;
  border-radius: 5px;
  font-size: 20px;
  padding: 4px 8px;
}

.sheets-sync-btn:hover {
  background-color: #d9d9d9;
}

@media screen and (max-width: 1024px) {
  .document-page {
    width: 95%;
    max-width: 210mm;
  }
}

/* Tablet styles */
@media screen and (max-width: 768px) {
 
  .app-container {
    bottom:0;
  }

  .header-container {
    padding: 8px 10px;
    display: flex;
    flex-direction: row;
  }

  .header-title {
    font-size: 1.2rem;
  }
  
  .header-title img {
    width: auto;
    height: 50px;
  }

  .document-name-field {
    width: 250px;
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .header-title {
    font-size: 1.3rem;
  }

  .action-buttons {
    gap: 8px;
  }
  
  .action-button {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
  
  .storage-buttons {
    border-right: none;
    margin-right: 8px;
    padding-right: 0;
  }
  
  .storage-button {
    padding: 6px 10px;
    margin-right: 5px;
  }
  
  .storage-button-text {
    display: none;
  }
  
  .storage-button-icon {
    margin-right: 0;
  }

  /* Format toolbar */
  .format-toolbar {
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .format-group {
    padding-right: 8px;
  }
  
  .format-button {
    padding: 5px 10px;
    font-size: 0.9rem;
  }
  
  /* Document container */
  .document-container {
    padding: 20px 10px;
  }
  
  /* Document page */
  .document-page {
    padding: 15mm;
    min-width: 95%;
  }
  
  .calculator-container {
    bottom: 20px;
    right: 20px;
  }

  .special-toolbar {
    display: none;
    margin-right: 8px;
    padding-right: 8px;
  }
  
  .special-tool-btn {
    padding: 6px 10px;
  }
  
  .iframe-header {
    padding: 8px 12px;
  }
  
  .iframe-title {
    font-size: 16px;
  }

  .share-dialog {
    width: 95%;
    max-width: none;
  }
  
  .share-url-container {
    flex-direction: column;
  }
  
  .share-url-copy {
    border-radius: 0;
  }
  
  #shareBtn span {
    display: none;
  }
  
  #shareBtn::before {
    content: '\f064';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
  }
  .assessment-toolbar {
    flex-direction: column;
    width: 100%;
  }
  .assessment-toolbar.active {
    display: none ;
  }
  #calculatorFrame {
    width: 100%;
    height: 720px;
  }

  .admin-panel {
    flex-direction: column;
  }
  
  .admin-sidebar {
    width: 100%;
    padding: 10px 0;
  }
  
  .admin-logo {
    padding: 10px 20px;
    margin-bottom: 0px;
  }
  
  .admin-menu-item {
    padding: 10px 20px;
  }
  
  .admin-content {
    padding: 10px;
  }
  
  .admin-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .admin-controls {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .approval-table, .users-table {
    display: block;
    overflow-x: auto;
  }
}

/* Mobile styles */
@media screen and (max-width: 480px) {
  /* Header adjustments */
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
  }
  
  .header-title {
    width: 100%;
    text-align: center;
    margin-bottom: 5px;
  }
  
  .action-buttons {
    width: 100%;
    justify-content: space-between;
  }
  
  .action-button {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
  }
  
  /* Format toolbar */
  .format-toolbar {
    padding: 5px;
    gap: 5px;
  }
  
  .format-group {
    padding-right: 5px;
    gap: 4px;
  }
  
  .format-button {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
  
  /* Document page */
  .document-page {
    padding: 10mm;
  }
  
  /* Block container adjustments */
  .add-block-buttons {
    left: -30px;
  }
  
  .add-block-button {
    width: 24px;
    height: 24px;
  }
  
  /* ML Block adjustments */
  .ml-block {
    padding: 8px;
  }
  
  .ml-controls {
    position: relative;
    top: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    opacity: 1;
  }
  
  /* Formula popup adjustments */
  .formula-popup {
    width: 95%;
    max-height: 90vh;
  }
  
  .formula-popup-content {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px;
  }
  
  .formula-item {
    padding: 8px;
  }
  
  .formula-popup-categories {
    gap: 5px;
    padding: 5px 10px;
  }
  
  .formula-category {
    padding: 4px 8px;
    font-size: 0.8rem;
  }

  #calculatorFrame {
    width: 280px;
    height: 380px;
  }
  
  .calculator-bubble {
    width: 50px;
    height: 50px;
  }
}

/* Landscape phone orientation */
@media screen and (max-height: 480px) and (orientation: landscape) {
  header {
    padding: 5px 10px;
  }
  
  .format-toolbar {
    padding: 5px;
  }
  
  .document-container {
    padding: 10px 5px;
  }
  
  .formula-popup {
    max-height: 85vh;
  }
  
  .formula-popup-header {
    padding: 8px 10px;
  }
  
  .formula-popup-content {
    max-height: 40vh;
  }
  .special-toolbar {
    margin-right: 4px;
    padding-right: 4px;
  }
  
  .special-tool-btn {
    padding: 4px 8px;
    font-size: 14px;
  }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
  /* Make buttons more touch-friendly */
  .format-button, .action-button, .control-button {
    min-height: 36px;
    min-width: 36px;
  }
  
  /* Make add block buttons always visible */
  .add-block-buttons {
    opacity: 0.7;
  }
  
  /* Make controls always visible */
  .ml-controls, .image-controls {
    opacity: 0;
  }
  
  /* Increase size of resize handles */
  .image-resize-handle {
    width: 16px;
    height: 16px;
    opacity: 0.7;
  }
  
  .image-resize-handle.top-left { top: -8px; left: -8px; }
  .image-resize-handle.top-right { top: -8px; right: -8px; }
  .image-resize-handle.bottom-left { bottom: -8px; left: -8px; }
  .image-resize-handle.bottom-right { bottom: -8px; right: -8px; }
  
  /* Increase spacing for formula items */
  .formula-item {
    padding: 12px;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
  }
  
  header, .format-toolbar, .add-block-buttons, .ml-controls, 
  .image-controls, .image-resize-handle, .add-text-after {
    display: none !important;
  }
  
  .document-container {
    padding: 0;
    overflow: visible;
    height: auto;
  }
  
  .document-page {
    box-shadow: none;
    margin: 0;
    padding: 0;
    page-break-after: always;
  }
  
  .pages-container {
    gap: 0;
  }
}