/* Global & Layout */
/* Optimized CSS - Consolidated mobile media queries and removed redundant selectors
   Improvements made:
   - Consolidated 7 @media (max-width: 768px) blocks into 1 comprehensive block
   - Removed redundant CSS selectors  
   - Reduced from 3720 lines to 3660 lines
   - Improved maintainability and organization */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; }
html { scroll-behavior: smooth; }
body { 
  font-family: 'Segoe UI', sans-serif; 
  background: #f0f4f8; 
  color: #333; 
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Enhanced theme transitions */
body.theme-transitioning * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Smooth transitions for common elements during theme change */
.navbar, .panel, .preview, .editor, .modal-content, .btn, .dropdown-menu {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Enhanced scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Dark mode scrollbar */
body.dark-mode ::-webkit-scrollbar-track {
  background: #2d2d2d;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: #555;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* ===================== */
/* NAVBAR STYLES */
/* ===================== */
.navbar {
  background: linear-gradient(135deg, #1976d2, #1565c0);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease, box-shadow 0.3s ease;
  backdrop-filter: blur(10px);
}

.navbar:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.navbar-container {
  max-width: 1400px; /* Better width for high-res displays */
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 1rem; /* Further reduced padding for even more compact navbar */
  gap: 0.6rem; /* Reduced gap for better space utilization */
  min-height: 38px; /* Further reduced height for more compact design */
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-size: 1.2rem; /* Further reduced for more compact navbar */
  font-weight: 800;
  color: white;
  text-decoration: none;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
  background: linear-gradient(45deg, #ffffff, #64b5f6, #e3f2fd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  align-items: center;
  gap: 0.3rem; /* Further reduced gap */
  transition: all 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
  text-shadow: 0 3px 8px rgba(0,0,0,0.5);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* Reduced gap for more compact layout */
  flex: 1;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.navbar-item {
  display: flex;
  align-items: center;
}

.navbar-btn {
  background: rgba(255, 255, 255, 0.15);
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.3rem 0.6rem; /* Reduced padding for more compact buttons */
  font-size: 0.8rem; /* Reduced font size for better space utilization */
  border-radius: 6px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem; /* Reduced gap */
}

.navbar-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.navbar-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.navbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: rgba(255, 255, 255, 0.1);
}

.navbar-input {
  padding: 0.3rem 0.6rem; /* Reduced padding for more compact inputs */
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  font-size: 0.8rem; /* Reduced font size */
  color: #333;
  min-width: 90px; /* Reduced min-width for better space utilization */
}

.navbar-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Enhanced Date Input Styling */
.navbar-input[type="date"] {
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.3rem 0.8rem 0.3rem 0.6rem; /* Extra right padding for calendar icon */
  min-width: 110px; /* Slightly wider for date display */
  font-family: 'Segoe UI', system-ui, sans-serif;
  cursor: pointer;
}

.navbar-input[type="date"]::-webkit-calendar-picker-indicator {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>') no-repeat center;
  background-size: 14px 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease;
  width: 16px;
  height: 16px;
  margin-left: 4px;
}

.navbar-input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%231976d2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>') no-repeat center;
  background-size: 14px 14px;
}

.navbar-input[type="date"]:focus {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.2);
}
  color: #333;
  font-size: 0.8rem; /* Smaller font size */
  transition: all 0.3s ease;
  min-width: 100px; /* Reduced min-width */
}

.navbar-input:focus {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
  outline: none;
}

/* Dropdown Styles */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.3rem 0.5rem; /* Reduced padding for more compact design */
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.75rem; /* Smaller font size for better space utilization */
  backdrop-filter: blur(10px);
}

.dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: #333;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

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

.dropdown-item:hover {
  background: rgba(25, 118, 210, 0.1);
  color: #1976d2;
  transform: translateX(4px);
}
  font-size: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
}

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

.dropdown-item:hover {
  background: #f8f9fa;
  color: #1976d2;
}

/* Hamburger Menu */
.navbar-toggle {
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.75rem;
  gap: 4px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.navbar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hamburger-line {
  width: 20px;
  height: 2px;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.navbar-toggle.active {
  background: rgba(255, 255, 255, 0.25);
}

.navbar-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.navbar-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* ===================== */
/* FOOTER STYLES */
/* ===================== */
.footer {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  padding: 0.5rem 0; /* Reduced from 1.25rem to 0.5rem */
  margin-top: auto;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 999; /* Lower than modals but high enough */
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1); /* Reduced shadow */
  flex-shrink: 0; /* Prevent shrinking */
  backdrop-filter: blur(10px);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem; /* Reduced from 0 2rem */
  gap: 1rem; /* Reduced from 1.5rem */
}

.footer-left p {
  font-size: 0.8rem; /* Reduced from 0.9rem */
  line-height: 1.4; /* Reduced from 1.5 */
  font-weight: 500;
}

.github-link {
  color: #64b5f6;
  text-decoration: none;
  transition: color 0.3s ease;
}

.github-link:hover {
  color: #90caf9;
  text-decoration: underline;
}

.license {
  color: #ccc;
}

.footer-right {
  display: flex;
  gap: 0.5rem; /* Reduced from 0.75rem */
}

.footer-btn {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.4rem 0.7rem; /* Reduced from 0.6rem 1rem */
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.75rem; /* Reduced from 0.875rem */
  font-weight: 500;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 0.3rem; /* Reduced from 0.5rem */
}

.footer-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ===================== */
/* RESPONSIVE NAVBAR */
/* ===================== */
/* Consolidated mobile styles moved to end of file */

/* ===================== */
/* MAIN LAYOUT UPDATES */
/* ===================== */
#app { 
  display: flex; 
  flex-wrap: nowrap; /* Prevent wrapping on large screens */
  flex: 1;
  min-height: calc(100vh - 100px); /* Reduced from 120px to account for smaller footer */
  max-width: 100%; /* Use full available width */
  margin: 0 auto; /* Center the app */
  padding: 5px 0.5rem; /* Added responsive top/bottom margin as requested */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  position: relative; /* For resizer positioning */
}

.panel { 
  flex: 1 1 50%; 
  display: flex; 
  flex-direction: column; 
  padding: 1.5rem; /* Increased padding for better spacing */
  overflow: hidden; 
  background: linear-gradient(135deg, #ffffff, #fafbfc); 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Enhanced transition */
  box-shadow: 0 6px 16px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08); /* Enhanced shadow as requested */
  border-radius: 12px; /* Increased border radius for modern look */
  margin: 5px 0.25rem; /* Added responsive top/bottom margin as requested */
  border: 1px solid rgba(25, 118, 210, 0.08);
}

/* Editor Panel - Enhanced styling */
#editor-panel {
  flex: 0 0 55%; /* Default 55% width */
  margin-right: 0.125rem; /* Half margin on right */
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  border: 1px solid rgba(25, 118, 210, 0.12);
}

#editor-panel:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.08); /* Enhanced shadow */
  border-color: rgba(25, 118, 210, 0.2);
  transform: translateY(-1px);
}

/* Preview Panel - Enhanced styling */  
#preview-panel {
  flex: 0 0 45%; /* Default 45% width */
  margin-left: 0.125rem; /* Half margin on left */
  background: linear-gradient(135deg, #ffffff, #f0f4f8);
  border: 1px solid rgba(25, 118, 210, 0.08);
}

#preview-panel:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.08); /* Enhanced shadow */
  border-color: rgba(25, 118, 210, 0.15);
  transform: translateY(-1px);
}

/* Panel Resizer - Enhanced with better colors and transitions */
.panel-resizer {
  width: 10px;
  background: linear-gradient(180deg, rgba(25, 118, 210, 0.1), rgba(25, 118, 210, 0.05));
  cursor: col-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 3px;
  margin: 0 2px;
}

.panel-resizer:hover {
  background: linear-gradient(180deg, rgba(25, 118, 210, 0.2), rgba(25, 118, 210, 0.1));
  transform: scaleX(1.2);
  box-shadow: 0 0 12px rgba(25, 118, 210, 0.15);
}

.panel-resizer::before {
  content: "|||";
  font-size: 12px;
  color: rgba(25, 118, 210, 0.6);
  font-weight: bold;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.panel-resizer:hover::before {
  color: rgba(25, 118, 210, 0.9);
  text-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
  transform: scale(1.1);
}

/* Active resizing state with enhanced visual feedback */
.panel-resizer.resizing {
  background: linear-gradient(180deg, rgba(25, 118, 210, 0.3), rgba(25, 118, 210, 0.15));
  transform: scaleX(1.3);
  box-shadow: 0 0 20px rgba(25, 118, 210, 0.25);
}

.panel-resizer.resizing::before {
  color: rgba(25, 118, 210, 1);
  transform: scale(1.2);
  text-shadow: 0 2px 6px rgba(25, 118, 210, 0.4);
}

/* Smooth transitions for panels during resize */
.panel.resizing {
  transition: none !important; /* Disable transitions during active resize for performance */
}

.panel:not(.resizing) {
  transition: flex 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#editor-panel { 
  padding: 1.5rem; /* Match panel padding */
  display: flex;
  flex-direction: column;
  gap: 0.75rem; /* Better spacing between toolbar and editor */
}

/* Enhanced Formatting Toolbar - Now positioned above editor */
.formatting-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem; /* Reduced from 0.4rem */
  padding: 0.7rem; /* Reduced from 0.8rem */
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  order: 1; /* Ensure it appears before the editor */
}

.editor { 
  flex: 1; 
  padding: 1.25rem; /* Better padding */
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace; /* Better font stack */
  font-size: 1rem; /* Slightly larger for better readability */
  line-height: 1.6; /* Better line height */
  border: 1px solid #dee2e6; 
  border-radius: 8px; /* Match toolbar radius */
  resize: none; 
  min-height: 400px; /* Minimum height for better usability */
  height: calc(100vh - 200px); /* Dynamic height based on viewport */
  transition: border-color 0.3s, background 0.3s;
  order: 2; /* Ensure it appears after the toolbar */
  margin-bottom: 16px; /* Enhanced bottom margin for better spacing */
  padding-bottom: 2rem; /* Additional internal padding at bottom for comfortable editing */
}

.editor:focus { border-color: #1976d2; }
/* ===================== */
/* Enhanced Toolbar Organization */
/* ===================== */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toolbar Header for Master Collapse */
.toolbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e1e5e9;
  margin-bottom: 0.5rem;
}

.toolbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toolbar-master-toggle {
  background: none;
  border: none;
  color: #1976d2;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.toolbar-master-toggle:hover {
  background: rgba(25, 118, 210, 0.1);
  transform: scale(1.1);
}

.toolbar-master-toggle.collapsed {
  transform: rotate(180deg);
}

/* Collapsed toolbar state */
.toolbar.collapsed .toolbar-sections {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.toolbar.collapsed {
  padding: 0.75rem 1rem;
}

.toolbar-sections {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 1000px;
  opacity: 1;
  overflow: visible;
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.primary-actions {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, #1976d2, #1565c0);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}

.primary-actions .btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.primary-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  padding-left: 0.25rem;
}

.section-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.section-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.input-field.compact {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 150px;
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
}

/* Section-specific styling with consistent padding */
.file-section {
  border-left: 4px solid #4caf50;
  background: rgba(76, 175, 80, 0.05);
  margin: 0.25rem 0;
}

.metadata-section {
  border-left: 4px solid #ff9800;
  background: rgba(255, 152, 0, 0.05);
  margin: 0.25rem 0;
}

.tools-section {
  border-left: 4px solid #9c27b0;
  background: rgba(156, 39, 176, 0.05);
  margin: 0.25rem 0;
}

/* Dark mode support for new toolbar */
body.dark-mode .toolbar {
  background: #2a2a2a;
  border-color: #444;
}

body.dark-mode .toolbar-header {
  border-bottom-color: #444;
}

body.dark-mode .toolbar-title {
  color: #e0e0e0;
}

body.dark-mode .toolbar-master-toggle {
  color: #64b5f6;
}

body.dark-mode .toolbar-master-toggle:hover {
  background: rgba(100, 181, 246, 0.1);
}

body.dark-mode .primary-actions {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
}

body.dark-mode .section-label {
  color: #bbb;
}

body.dark-mode .file-section {
  background: rgba(76, 175, 80, 0.15);
  border-left-color: #66bb6a;
}

body.dark-mode .metadata-section {
  background: rgba(255, 152, 0, 0.15);
  border-left-color: #ffb74d;
}

body.dark-mode .tools-section {
  background: rgba(156, 39, 176, 0.15);
  border-left-color: #ba68c8;
}

/* Responsive design for organized toolbar */
@media (max-width: 1024px) {
  .toolbar {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .primary-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
  
  .section-buttons {
    justify-content: center;
  }
  
  .section-inputs {
    justify-content: center;
  }
  
  .input-field.compact {
    min-width: 90px;
    max-width: 120px;
  }
}

/* Collapsible Tools Section */
.tools-toggle {
  background: none;
  border: none;
  color: #9c27b0;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
  margin-left: auto;
}

.tools-toggle:hover {
  background: rgba(156, 39, 176, 0.1);
  transform: scale(1.1);
}

.tools-toggle.collapsed {
  transform: rotate(-90deg);
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: #666;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

#tools-buttons {
  transition: all 0.4s ease;
  overflow: hidden;
  opacity: 1;
  max-height: 200px;
}

#tools-buttons.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding: 0;
}

/* Enhanced Button Animations */
.btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: width 0.6s, height 0.6s;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn > * {
  position: relative;
  z-index: 1;
}

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

.btn:active {
  transform: translateY(0);
}

/* Enhanced Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  animation: modalFadeIn 0.3s ease;
  /* Ensure proper centering */
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

@keyframes modalFadeIn {
  from { 
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to { 
    opacity: 1;
    backdrop-filter: blur(5px);
  }
}

.modal-content {
  background-color: #fefefe;
  position: relative;
  padding: 1.5rem; /* Reduced from 2rem */
  border: none;
  border-radius: 12px; /* Reduced from 16px for more compact look */
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25); /* Reduced shadow */
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Faster animation */
  max-width: 85vw; /* Reduced from 90vw */
  max-height: 85vh; /* Reduced from 90vh */
  overflow-y: auto;
  margin: 5vh auto; /* Better centering */
}

/* Improved close button */
.close {
  color: #aaa;
  float: right;
  font-size: 24px; /* Reduced from default */
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  background: rgba(0,0,0,0.05);
}

.close:hover,
.close:focus {
  color: #000;
  background: rgba(0,0,0,0.1);
  text-decoration: none;
  transform: scale(1.1);
}

/* Modal header improvements */
.modal-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
  margin-bottom: 1rem;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 1.3rem; /* Reduced size */
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Modal body improvements */
.modal-body {
  padding: 0.5rem 0;
}

.modal-body p {
  margin: 0.5rem 0;
  line-height: 1.5;
  color: #666;
  font-size: 0.95rem; /* Slightly smaller */
}
  /* Center the modal properly */
  margin: auto;
  transform: none;
}

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

/* Confirmation Modal Styling */
.confirmation-modal {
  max-width: 450px;
  width: 90%;
  text-align: center;
}

.modal-header {
  margin-bottom: 1.5rem;
}

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

.modal-body {
  margin-bottom: 2rem;
}

.modal-body p {
  margin: 0;
  color: #666;
  font-size: 1rem;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #5a6268);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Dark Mode Support for New Elements */
body.dark-mode .modal-content {
  background-color: #2a2a2a;
  color: #fff;
}

body.dark-mode .modal-header h3 {
  color: #fff;
}

body.dark-mode .modal-body p {
  color: #ccc;
}

body.dark-mode .tools-toggle {
  color: #ba68c8;
}

body.dark-mode .tools-toggle:hover {
  background: rgba(186, 104, 200, 0.1);
}

/* Improved Responsive Design */
/* Buttons & Inputs */
.input-field {
  flex: 1 1 150px;
  min-width: 120px;
  padding: 0.5rem;
  margin-right: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: border-color 0.3s, background 0.3s;
}
.input-field:focus { border-color: #1976d2; }
.btn {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 4px;
  background: #90a4ae;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:not(:disabled):hover { background: #78909c; transform: translateY(-1px); }
.primary-btn { background: #1976d2; }
.primary-btn:hover { background: #115293; }

.format-btn {
  padding: 0.3rem 0.5rem; /* Reduced from 0.4rem 0.6rem */
  border: 1px solid #dee2e6;
  border-radius: 6px; /* Rounded corners */
  background: white;
  color: #495057;
  cursor: pointer;
  font-size: 0.75rem; /* Reduced from 0.8rem */
  font-weight: 500; /* Medium weight for better visibility */
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.format-btn:hover {
  background: #e9ecef;
  border-color: #1976d2;
  color: #1976d2;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}

.format-btn:active {
  background: #dee2e6;
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Format Dropdown Styles */
.format-dropdown {
  position: relative;
  display: inline-block;
}

.format-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  max-height: 0;
  overflow-y: auto;
}

.format-dropdown:hover .format-dropdown-menu,
.format-dropdown.active .format-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  max-height: 300px;
}

.format-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: #495057;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f8f9fa;
}

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

.format-dropdown-item:hover {
  background: #f8f9fa;
  color: #1976d2;
}

.format-dropdown-item:active {
  background: #e9ecef;
}

/* Sub-item indentation in dropdown */
.format-dropdown-item.sub-item {
  padding-left: 2rem;
  font-style: italic;
  color: #6c757d;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.export-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 1000;
  min-width: 120px;
}

.export-dropdown:hover .export-menu {
  display: block;
}

.export-option {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: white;
  color: #333;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.export-option:hover {
  background: #f8f9fa;
}

/* Template Selector */
.template-selector {
  transition: border-color 0.3s, background 0.3s;
}

/* Spinner Animation */
.spinner {
  width: 24px;
  height: 24px;
  margin-left: 0.5rem;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview Panel */
#preview-panel {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s;
}
#preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: #f7f9fa;
  border-bottom: 1px solid #ddd;
  transition: background 0.3s, color 0.3s;
}
#preview-header h2 {
  margin: 0;
  font-size: 1.25rem;
}
#preview-header .btn {
  margin: 0;
}
.preview {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  border-top: none;
  background: #fafafa;
  transition: background 0.3s, color 0.3s;
}

/* Preview Content Styling with improved tables */
.preview h1 { color: #1976d2; margin-top: 0; }
.preview h2 { color: #1565c0; }
.preview p { line-height: 1.6; margin: 0.75em 0; }
.preview blockquote { border-left: 4px solid #90a4ae; padding-left: 1rem; color: #546e7a; font-style: italic; }
.preview pre { background: #263238; color: #eceff1; padding: 0.75rem; border-radius: 4px; overflow-x: auto; }
.preview code { background: #eceff1; padding: 0.2em 0.4em; border-radius: 3px; }

/* Enhanced list styling with proper indentation */
.preview ul, .preview ol {
  margin: 1em 0;
  padding-left: 0;
}

.preview li {
  margin: 0.5em 0;
  margin-left: 2rem; /* Base indentation for all list items */
}

/* Nested lists with progressive indentation */
.preview ul ul, .preview ol ol, .preview ul ol, .preview ol ul {
  margin: 0.25em 0;
  margin-left: 1.5rem; /* Additional indentation for nested lists */
}

/* Third level nesting */
.preview ul ul ul, .preview ol ol ol, 
.preview ul ol ul, .preview ol ul ol,
.preview ul ul ol, .preview ol ol ul {
  margin-left: 1.5rem; /* Further indentation for deeply nested lists */
}

/* Make sure nested list items have appropriate spacing */
.preview li li {
  margin-left: 0; /* Reset since parent ul/ol already provides indentation */
}

/* Enhanced table styling */
.preview table,
.preview .markdown-table { 
  width: 100%; 
  border-collapse: collapse; 
  margin: 1em 0; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-radius: 6px;
  overflow: hidden;
}

.preview th, 
.preview td { 
  border: 1px solid #b0bec5; 
  padding: 0.75em 1em; 
  text-align: left;
  vertical-align: top;
}

.preview th {
  background: linear-gradient(135deg, #1976d2, #1565c0);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.preview tr:nth-child(even) {
  background: #f8f9fa;
}

.preview tr:hover {
  background: #e3f2fd;
  transition: background-color 0.2s ease;
}

/* Enhanced Dark Theme with Better Contrast & Accessibility and Smooth Transitions */
body.dark-mode {
  background: #1a1a1a;
  color: #e8e8e8;
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth transitions for all theme-sensitive elements */
body {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel, .navbar, .footer, .modal-content, .formatting-toolbar {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.editor, .preview, .btn, .format-btn, .navbar-input, .dropdown-menu {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced theme button feedback */
button[id="theme-btn"] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

button[id="theme-btn"]:active {
  transform: scale(0.95);
}

button[id="theme-btn"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

button[id="theme-btn"]:active::after {
  width: 200%;
  height: 200%;
}

/* Theme transitioning state for enhanced effects */
body.theme-transitioning * {
  transition-duration: 0.4s !important;
}

/* Enhanced notification system for theme feedback */
.theme-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1001;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Dark Mode Navbar */
body.dark-mode .navbar {
  background: linear-gradient(135deg, #0d47a1, #1565c0);
}

body.dark-mode .navbar-input {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .navbar-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Dark mode support for enhanced date input */
body.dark-mode .navbar-input[type="date"] {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .navbar-input[type="date"]::-webkit-calendar-picker-indicator {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>') no-repeat center;
  background-size: 14px 14px;
  opacity: 0.8;
}

body.dark-mode .navbar-input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2364b5f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>') no-repeat center;
  background-size: 14px 14px;
}

body.dark-mode .navbar-input[type="date"]:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.2);
}

body.dark-mode .dropdown-menu {
  background: #2d2d2d;
  border-color: #404040;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

body.dark-mode .dropdown-item {
  color: #e8e8e8;
  border-bottom-color: #404040;
}

body.dark-mode .dropdown-item:hover {
  background: #3a3a3a;
  color: #64b5f6;
}

/* Dark Mode Footer */
body.dark-mode .footer {
  background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
  border-top: 1px solid #404040;
}

body.dark-mode .github-link {
  color: #64b5f6;
}

body.dark-mode .github-link:hover {
  color: #90caf9;
}

body.dark-mode .license {
  color: #aaa;
}

/* Dark mode responsive navbar */
body.dark-mode .panel {
  background: #2d2d2d;
  border-color: #404040;
}

body.dark-mode .toolbar {
  background: #262626;
  border-color: #404040;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-mode .formatting-toolbar {
  background: #262626;
  border-color: #404040;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Enhanced button visibility in dark mode */
body.dark-mode .btn {
  background: #3a3a3a;
  color: #e8e8e8;
  border: 1px solid #555;
  transition: all 0.2s ease;
}

body.dark-mode .btn:hover {
  background: #4a4a4a;
  border-color: #666;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

body.dark-mode .btn.primary-btn {
  background: #1976d2;
  color: #ffffff;
  border-color: #1976d2;
  font-weight: 500;
}

body.dark-mode .btn.primary-btn:hover {
  background: #1565c0;
  border-color: #1565c0;
  box-shadow: 0 3px 12px rgba(25, 118, 210, 0.4);
}

body.dark-mode .btn:disabled {
  background: #2a2a2a;
  color: #666;
  border-color: #333;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

body.dark-mode .format-btn {
  background: #3a3a3a;
  color: #e8e8e8;
  border-color: #555;
  transition: all 0.2s ease;
}

body.dark-mode .format-btn:hover {
  background: #4a4a4a;
  border-color: #666;
  transform: translateY(-1px);
}

body.dark-mode .format-btn.active {
  background: #1976d2;
  color: #ffffff;
  border-color: #1976d2;
}

/* Dark mode dropdown styles */
body.dark-mode .format-dropdown-menu {
  background: #3a3a3a;
  border-color: #555;
}

body.dark-mode .format-dropdown-item {
  color: #e8e8e8;
  border-bottom-color: #555;
}

body.dark-mode .format-dropdown-item:hover {
  background: #4a4a4a;
  color: #1976d2;
}

body.dark-mode .format-dropdown-item:active {
  background: #555;
}

/* Dark mode sub-items */
body.dark-mode .format-dropdown-item.sub-item {
  color: #aaa;
}

body.dark-mode .input-field {
  background: #3a3a3a;
  color: #e8e8e8;
  border-color: #555;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .input-field:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
  outline: none;
}

body.dark-mode .template-selector {
  background: #3a3a3a;
  color: #e8e8e8;
  border-color: #555;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .template-selector:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
  outline: none;
}

body.dark-mode .template-selector option {
  background: #3a3a3a;
  color: #e8e8e8;
  border: none;
}

body.dark-mode .editor {
  background: #2d2d2d;
  color: #e8e8e8;
  border-color: #404040;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .editor:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
  outline: none;
}

body.dark-mode .preview {
  background: #2d2d2d;
  color: #e8e8e8;
  border-color: #404040;
}

/* Dark Mode Support for Enhanced Panels and Resizer */
body.dark-mode .panel {
  background: linear-gradient(135deg, #2d2d2d, #262626);
  border-color: rgba(100, 181, 246, 0.15);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 4px 8px rgba(0,0,0,0.25); /* Enhanced dark mode shadow */
}

body.dark-mode #editor-panel {
  background: linear-gradient(135deg, #2d2d2d, #2a2a2a);
  border-color: rgba(100, 181, 246, 0.2);
}

body.dark-mode #editor-panel:hover {
  box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 6px 12px rgba(0,0,0,0.25); /* Enhanced dark mode shadow */
  border-color: rgba(100, 181, 246, 0.3);
}

body.dark-mode #preview-panel {
  background: linear-gradient(135deg, #2d2d2d, #252525);
  border-color: rgba(100, 181, 246, 0.15);
}

body.dark-mode #preview-panel:hover {
  box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 6px 12px rgba(0,0,0,0.25); /* Enhanced dark mode shadow */
  border-color: rgba(100, 181, 246, 0.25);
}

body.dark-mode .panel-resizer {
  background: linear-gradient(180deg, rgba(100, 181, 246, 0.15), rgba(100, 181, 246, 0.08));
}

body.dark-mode .panel-resizer:hover {
  background: linear-gradient(180deg, rgba(100, 181, 246, 0.25), rgba(100, 181, 246, 0.15));
  box-shadow: 0 0 12px rgba(100, 181, 246, 0.2);
}

body.dark-mode .panel-resizer::before {
  color: rgba(100, 181, 246, 0.7);
}

body.dark-mode .panel-resizer:hover::before {
  color: rgba(100, 181, 246, 1);
  text-shadow: 0 2px 4px rgba(100, 181, 246, 0.4);
}

body.dark-mode .panel-resizer.resizing {
  background: linear-gradient(180deg, rgba(100, 181, 246, 0.35), rgba(100, 181, 246, 0.2));
  box-shadow: 0 0 20px rgba(100, 181, 246, 0.3);
}

body.dark-mode .panel-resizer.resizing::before {
  color: rgba(100, 181, 246, 1);
  text-shadow: 0 2px 6px rgba(100, 181, 246, 0.5);
}

/* Dark mode support for tablet-specific resizer enhancements */
@media (min-width: 769px) and (max-width: 1024px) {
  body.dark-mode .panel-resizer {
    background: linear-gradient(180deg, rgba(100, 181, 246, 0.2), rgba(100, 181, 246, 0.1));
  }
  
  body.dark-mode .panel-resizer:hover, 
  body.dark-mode .panel-resizer:active {
    background: linear-gradient(180deg, rgba(100, 181, 246, 0.35), rgba(100, 181, 246, 0.2));
    box-shadow: 0 0 15px rgba(100, 181, 246, 0.25);
  }
  
  body.dark-mode .panel-resizer::before {
    color: rgba(100, 181, 246, 0.8);
  }
  
  body.dark-mode .panel-resizer:hover::before, 
  body.dark-mode .panel-resizer:active::before {
    color: rgba(100, 181, 246, 1);
    text-shadow: 0 2px 6px rgba(100, 181, 246, 0.4);
  }
}

body.dark-mode .darkable {
  background: linear-gradient(135deg, #2d2d2d, #262626);
  color: #e8e8e8;
  transition: all 0.3s ease;
}

body.dark-mode .darkable h2 {
  color: #e8e8e8;
}

body.dark-mode #preview-panel {
  background: #2d2d2d;
}

body.dark-mode #preview-header {
  background: #262626;
  border-color: #404040;
  color: #e8e8e8;
}

body.dark-mode .spinner {
  border-top-color: #1976d2;
}

body.dark-mode .export-menu {
  background: #2d2d2d;
  border: 1px solid #404040;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4);
}

body.dark-mode .export-option {
  background: #2d2d2d;
  color: #e8e8e8;
  border-bottom: 1px solid #404040;
  transition: background-color 0.2s ease;
}

body.dark-mode .export-option:hover {
  background: #3a3a3a;
}

/* Dark mode content styling */
body.dark-mode code {
  background: #3a3a3a;
  color: #e8e8e8;
  border: 1px solid #555;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

body.dark-mode pre {
  background: #262626;
  border: 1px solid #404040;
  border-radius: 4px;
  padding: 1em;
}

body.dark-mode pre code {
  background: transparent;
  border: none;
  padding: 0;
}

body.dark-mode blockquote {
  border-left: 4px solid #1976d2;
  background: #3a3a3a;
  padding: 1em;
  margin: 1em 0;
  border-radius: 0 4px 4px 0;
}

body.dark-mode table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  border: 1px solid #404040;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark-mode th,
body.dark-mode td {
  border: 1px solid #404040;
  padding: 0.75em 1em;
  text-align: left;
}

body.dark-mode th {
  background: linear-gradient(135deg, #1976d2, #1565c0);
  color: #ffffff;
  font-weight: 600;
}

body.dark-mode tr:nth-child(even) {
  background: #363636;
}

body.dark-mode tr:hover {
  background: #404040;
}

body.dark-mode .markdown-table {
  border: 1px solid #404040;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark-mode a {
  color: #64b5f6;
}

body.dark-mode a:hover {
  color: #90caf9;
}

/* Enhanced Responsive Design */
/* Enhanced mobile responsive design */
/* Tablets: optimized layout */
/* Tablet view improvements - optimized for touch and better spacing */
@media (min-width: 769px) and (max-width: 1024px) {
  .navbar-container {
    padding: 0.3rem 1.2rem; /* Optimized for tablet, keeping consistency */
    gap: 1rem; /* Balanced gap for tablet */
  }
  
  /* Footer positioning for tablet - non-sticky */
  .footer {
    position: static;
    margin-top: auto;
  }
  
  #app { 
    flex-direction: row; 
    min-height: calc(100vh - 80px); /* Reduced height compensation for non-sticky footer */
    padding: 5px 0.5rem; /* Maintain responsive spacing for tablet */
    gap: 0.5rem; /* Reduced gap for more content space */
  }
  
  .panel { 
    margin: 0; /* Remove margin, use gap instead */
    padding: 1.5rem; /* Increased padding for better touch experience */
    border-radius: 12px; /* Larger border radius for modern look */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); /* Enhanced shadow */
  }

  /* Apply 55-45% split for tablet screens */
  #editor-panel {
    flex: 1 1 55%; /* 55% editor width for tablets */
    max-width: 60%;
  }
  
  #preview-panel {
    flex: 1 1 45%; /* 45% preview width for tablets */
    max-width: 45%;
    min-width: 280px; /* Adjust minimum width for tablets */
  }
  
  /* Enhanced panel resizer for tablet touch interactions */
  .panel-resizer {
    width: 16px; /* Wider resizer for better touch targets */
    background: linear-gradient(180deg, rgba(25, 118, 210, 0.15), rgba(25, 118, 210, 0.08));
    cursor: col-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px; /* Larger border radius for touch */
    margin: 0 4px; /* More margin for better separation */
    /* Improve touch target */
    touch-action: pan-x;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .panel-resizer:hover, .panel-resizer:active {
    background: linear-gradient(180deg, rgba(25, 118, 210, 0.25), rgba(25, 118, 210, 0.15));
    transform: scaleX(1.2);
    box-shadow: 0 0 12px rgba(25, 118, 210, 0.2);
  }
  
  .panel-resizer::before {
    content: "⋮⋮⋮";
    font-size: 14px;
    color: rgba(25, 118, 210, 0.7);
    font-weight: bold;
    line-height: 1;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  .panel-resizer:hover::before, .panel-resizer:active::before {
    color: rgba(25, 118, 210, 1);
    text-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
    transform: scale(1.1);
  }
  
  .formatting-toolbar {
    gap: 0.5rem; /* Better spacing between buttons */
    padding: 1rem; /* Increased padding */
    border-radius: 10px; /* Consistent border radius */
  }
  
  .format-btn {
    padding: 0.35rem 0.55rem; /* Smaller but still touch-friendly */
    font-size: 0.75rem; /* Consistent with desktop */
    min-height: 40px; /* Reduced from 44px but still accessible */
    border-radius: 6px; /* Rounded buttons */
    transition: all 0.2s ease; /* Smooth hover effects */
  }
  
  .format-btn:hover {
    transform: translateY(-1px); /* Subtle hover effect */
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  
  .editor {
    font-size: 1rem; /* Improved readability */
    padding: 1.25rem; /* Better padding */
    border-radius: 10px; /* Consistent with other elements */
    line-height: 1.7; /* Better line spacing for readability */
    margin-bottom: 18px; /* Enhanced bottom margin for tablets */
    padding-bottom: 2rem; /* Comfortable bottom padding for touch editing */
  }
  
  .btn, .input-field {
    font-size: 0.9rem; /* Slightly larger for better readability */
    padding: 0.5rem 0.75rem; /* Better touch targets */
    min-height: 44px; /* Minimum touch target size */
  }
  
  .navbar-input {
    min-width: 120px; /* Increased minimum width */
    font-size: 0.9rem; /* Improved readability */
    padding: 0.5rem 0.75rem; /* Better touch targets */
  }
  
  /* Improve dropdown menus for tablet */
  .dropdown-toggle, .export-dropdown button {
    min-height: 44px; /* Touch-friendly size */
    padding: 0.5rem 1rem;
  }
  
  .dropdown-menu, .export-menu {
    border-radius: 10px; /* Consistent styling */
    padding: 0.5rem 0; /* Better spacing */
  }
  
  .dropdown-item, .export-option {
    padding: 0.75rem 1rem; /* Larger touch targets */
    font-size: 0.9rem;
  }
}

/* Desktop and larger: dynamic panel layout */
@media (min-width: 1025px) {
  .navbar-container {
    padding: 0.25rem 1.5rem; /* Optimized desktop padding, keeping compact */
    gap: 1rem; /* Balanced gap for desktop */
  }
  
  #app { 
    flex-direction: row; 
    min-height: calc(100vh - 160px);
    padding: 5px 0.5rem; /* Maintain responsive spacing for desktop */
    gap: 0.5rem; /* Reduced gap for more content space */
    max-width: 100%; /* Use full width available */
    margin: 0; /* Remove auto centering for full width */
  }
  
  .panel { 
    margin: 0; /* Remove margin, use gap */
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  }
  
  /* Editor panel optimized for tablet/desktop - 55% split */
  #editor-panel {
    flex: 1 1 55%; /* 55% editor width as per requirements */
    max-width: 60%; /* Allow some flexibility for complex documents */
  }
  
  /* Preview panel optimized for reading - 45% split */
  #preview-panel {
    flex: 1 1 45%; /* 45% preview width as per requirements */
    max-width: 45%; /* Maintain proportional width */
    min-width: 300px; /* Ensure minimum readable width */
  }
  
  .formatting-toolbar {
    gap: 0.4rem; /* Slightly larger gap for tablet */
    padding: 0.8rem;
    border-radius: 8px;
  }
  
  .editor {
    font-size: 1rem;
    line-height: 1.6;
    min-height: 400px;
    border-radius: 8px;
  }
}

/* Ultra-wide screens: optimized layout with better space utilization */
@media (min-width: 1400px) {
  .navbar-container {
    max-width: 100%; /* Use full width */
    padding: 1rem 2rem; /* Reduced padding for more content space */
    gap: 2rem;
  }
  
  #app {
    max-width: 100%; /* Use full screen width */
    padding: 5px 1rem; /* Maintain responsive spacing with more side padding */
    gap: 0.75rem; /* Optimized gap for ultra-wide */
    margin: 0; /* Remove centering for full width utilization */
  }
  
  /* Dynamic panel sizing for ultra-wide screens - maintain 55-45% ratio */
  #editor-panel {
    flex: 1 1 55%; /* Maintain 55% on ultra-wide as well */
    max-width: 60%; /* Comfortable typing area */
    min-width: 600px; /* Minimum comfortable width */
  }
  
  #preview-panel {
    flex: 1 1 45%; /* Maintain 45% on ultra-wide */
    max-width: 45%; /* Optimized preview width for ultra-wide */
    min-width: 400px; /* Minimum readable width */
  }
  
  .panel {
    margin: 0; /* Use gap instead */
    padding: 2rem;
    border-radius: 16px; /* Larger radius for modern look */
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  }
  
  .formatting-toolbar {
    padding: 1.25rem;
    gap: 0.75rem;
    border-radius: 12px;
  }
  
  .format-btn {
    padding: 0.45rem 0.65rem; /* Compact but comfortable for desktop */
    font-size: 0.8rem; /* Slightly larger for better readability on larger screens */
  }
  
  .editor {
    font-size: 1.1rem;
    line-height: 1.7;
    padding: 1.5rem;
    border-radius: 12px;
  }
  
  .navbar-input {
    min-width: 140px;
    padding: 0.6rem 0.9rem;
  }
  
  /* Preview content styling for ultra-wide */
  #preview-pane {
    font-size: 1.05rem;
    line-height: 1.8;
    max-width: none; /* Allow full width usage */
  }
}

/* Help Modal Enhancements */
#help-modal .modal-content {
  max-width: 900px;
  width: 95%;
  padding: 1.5rem;
}

.help-section {
  margin-bottom: 2rem;
}

.help-section h3 {
  color: #1976d2;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f5f5f5;
  border-radius: 6px;
  border-left: 3px solid #1976d2;
  transition: all 0.2s ease;
}

.shortcut-item:hover {
  background: #e8f4fd;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.shortcut-item kbd {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  font-family: monospace;
  margin: 0 0.1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  white-space: nowrap;
}

.shortcut-item span {
  color: #555;
  font-size: 0.9rem;
  text-align: right;
  flex: 1;
  margin-left: 0.5rem;
}

.markdown-reference {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.ref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem;
  background: #f8f9fa;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.ref-item:hover {
  background: #e9ecef;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ref-item code {
  background: #e9ecef;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #d63384;
  font-weight: 500;
}

.ref-item span {
  color: #666;
  font-size: 0.85rem;
  text-align: right;
  flex: 1;
  margin-left: 0.5rem;
}

.tips-list {
  list-style: none;
  padding: 0;
}

.tips-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
  line-height: 1.5;
}

.tips-list li:last-child {
  border-bottom: none;
}

.tips-list strong {
  color: #1976d2;
}

/* Dark mode help modal */
body.dark-mode .modal-content {
  background: #2d2d2d;
  color: #e8e8e8;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

body.dark-mode .close {
  color: #ccc;
}

body.dark-mode .close:hover,
body.dark-mode .close:focus {
  color: #fff;
}

body.dark-mode #help-modal .modal-content {
  background: #2d2d2d;
  color: #e8e8e8;
}

body.dark-mode .help-section h3 {
  color: #64b5f6;
}

body.dark-mode .shortcut-item {
  background: #3a3a3a;
  border-left-color: #64b5f6;
}

body.dark-mode .shortcut-item:hover {
  background: #4a4a4a;
}

body.dark-mode .shortcut-item kbd {
  background: #4a4a4a;
  border-color: #666;
  color: #e8e8e8;
}

body.dark-mode .shortcut-item span {
  color: #ccc;
}

body.dark-mode .ref-item {
  background: #3a3a3a;
}

body.dark-mode .ref-item:hover {
  background: #4a4a4a;
}

body.dark-mode .ref-item code {
  background: #4a4a4a;
  color: #f8a2c2;
}

body.dark-mode .ref-item span {
  color: #ccc;
}

body.dark-mode .tips-list li {
  border-bottom-color: #404040;
}

body.dark-mode .tips-list strong {
  color: #64b5f6;
}

/* Statistics Modal Styles */
#stats-modal .modal-content {
  max-width: 950px;
  width: 95%;
  padding: 1.5rem;
}

.stats-container {
  margin-top: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  text-align: center;
  padding: 1.25rem 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  cursor: default;
}

.stat-card:hover {
  border-color: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.15);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: bold;
  color: #1976d2;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  line-height: 1.2;
}

.detailed-stats h3,
.readability-score h3 {
  color: #1976d2;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.stats-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #1976d2;
  transition: all 0.2s ease;
}

.detail-item:hover {
  background: #e8f4fd;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-label {
  font-weight: 500;
  color: #333;
  flex: 1;
}

.detail-value {
  font-weight: bold;
  color: #1976d2;
  margin-left: 1rem;
  white-space: nowrap;
}

.readability-score {
  background: #f0f7ff;
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid #b3d9ff;
}

.readability-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.readability-item:last-child {
  margin-bottom: 0;
}

.readability-label {
  font-weight: 500;
  color: #333;
  flex: 1;
}

.readability-value {
  font-weight: bold;
  color: #0d47a1;
  padding: 0.35rem 0.75rem;
  background: #e3f2fd;
  border-radius: 6px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Dark mode stats */
body.dark-mode #stats-modal .modal-content {
  background: #2d2d2d;
  color: #e8e8e8;
}

body.dark-mode .stat-card {
  background: #3a3a3a;
  border-color: #555;
}

body.dark-mode .stat-card:hover {
  border-color: #64b5f6;
  box-shadow: 0 4px 12px rgba(100, 181, 246, 0.2);
}

body.dark-mode .stat-number {
  color: #64b5f6;
}

body.dark-mode .stat-label {
  color: #ccc;
}

body.dark-mode .detailed-stats h3,
body.dark-mode .readability-score h3 {
  color: #64b5f6;
}

body.dark-mode .detail-item {
  background: #3a3a3a;
  border-left-color: #64b5f6;
}

body.dark-mode .detail-item:hover {
  background: #4a4a4a;
}

body.dark-mode .detail-label {
  color: #e8e8e8;
}

body.dark-mode .detail-value {
  color: #64b5f6;
}

body.dark-mode .readability-score {
  background: #2a2a2a;
  border-color: #404040;
}

body.dark-mode .readability-label {
  color: #e8e8e8;
}

body.dark-mode .readability-value {
  color: #64b5f6;
  background: #3a3a3a;
  border: 1px solid #555;
}

/* Image Support and Positioning */
.preview img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  margin: 15px 0;
  transition: all 0.3s ease;
}

.preview img:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transform: translateY(-2px);
  cursor: pointer;
}

.preview img.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.preview img.right {
  float: right;
  margin-left: 20px;
  margin-bottom: 15px;
  max-width: 50%;
}

.preview img.left {
  float: left;
  margin-right: 20px;
  margin-bottom: 15px;
  max-width: 50%;
}

.preview img.float-left {
  float: left;
  margin: 0 20px 15px 0;
  max-width: 40%;
}

.preview img.float-right {
  float: right;
  margin: 0 0 15px 20px;
  max-width: 40%;
}

.preview .image-container {
  clear: both;
  margin: 25px 0;
  text-align: center;
}

.preview .image-caption {
  font-style: italic;
  text-align: center;
  color: #666;
  font-size: 0.9em;
  margin-top: 8px;
  padding: 0 10px;
}

/* Image preview modal */
#image-preview-modal .modal-content {
  max-width: 95vw;
  max-height: 95vh;
  text-align: center;
  padding: 1rem;
}

#preview-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

#preview-caption {
  margin-top: 15px;
  font-style: italic;
  color: #666;
  font-size: 1rem;
}

/* Dark mode image styles */
body.dark-mode .preview img {
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

body.dark-mode .preview img:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

body.dark-mode .preview .image-caption {
  color: #ccc;
}

body.dark-mode #preview-caption {
  color: #ccc;
}

/* Enhanced formatting toolbar for image upload */
.format-btn#upload-image-btn {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  border: none;
  font-weight: 500;
}

.format-btn#upload-image-btn:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

body.dark-mode .format-btn#upload-image-btn {
  background: linear-gradient(135deg, #4caf50, #45a049);
}

body.dark-mode .format-btn#upload-image-btn:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

/* Tutorial and image help styles */
.image-help {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid #4caf50;
  margin: 1rem 0;
}

.image-help h4 {
  color: #2e7d32;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.image-help ol, .image-help ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.image-help li {
  margin: 0.5rem 0;
  line-height: 1.5;
}

.image-help code {
  background: #e8f5e8;
  color: #2e7d32;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
}

body.dark-mode .image-help {
  background: #2a2a2a;
  border-left-color: #66bb6a;
}

body.dark-mode .image-help h4 {
  color: #66bb6a;
}

body.dark-mode .image-help code {
  background: #3a3a3a;
  color: #66bb6a;
}

/* Auto-save indicator */
.content-warning {
  animation: slideInTop 0.3s ease;
  z-index: 100;
}

@keyframes slideInTop {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Loading states */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: white;
  margin-left: 1rem;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Enhanced accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus improvements */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}

body.dark-mode button:focus,
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
  outline-color: #64b5f6;
}

/* Improved contrast for better readability */
.high-contrast {
  filter: contrast(1.2);
}

/* ===================== */
/* Notification System */
/* ===================== */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.notification {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-left: 4px solid #1976d2;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease-in-out;
  overflow: hidden;
}

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

.notification-hide {
  opacity: 0;
  transform: translateX(100%);
}

.notification-content {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.notification-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  color: #333;
  font-size: 14px;
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.notification-close:hover {
  background-color: #f0f0f0;
  color: #333;
}

/* Notification types */
.notification-success {
  border-left-color: #4caf50;
}

.notification-error {
  border-left-color: #f44336;
}

.notification-warning {
  border-left-color: #ff9800;
}

.notification-info {
  border-left-color: #2196f3;
}

/* Dark mode support for notifications */
body.dark-mode .notification {
  background: #333;
  border-left-color: #64b5f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .notification-message {
  color: #fff;
}

body.dark-mode .notification-close {
  color: #ccc;
}

body.dark-mode .notification-close:hover {
  background-color: #444;
  color: #fff;
}

body.dark-mode .notification-success {
  border-left-color: #81c784;
}

body.dark-mode .notification-error {
  border-left-color: #e57373;
}

body.dark-mode .notification-warning {
  border-left-color: #ffb74d;
}

body.dark-mode .notification-info {
  border-left-color: #64b5f6;
}

/* Print styles for notifications - Hide during print/PDF export */
@media print {
  /* Hide all notification and UI elements */
  .notification-container,
  .notification {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Hide auto-save notifications and any floating elements */
  .auto-save-notification,
  .theme-notification,
  .floating-notification {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Hide navigation, toolbar, and footer elements */
  .navbar,
  .formatting-toolbar,
  .footer,
  #navbar,
  #footer {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Hide editor panel and show only preview for print */
  #editor-panel,
  .panel-resizer {
    display: none !important;
  }
  
  /* Ensure preview takes full width for print */
  #preview-panel {
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  #preview-pane {
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
  
  /* Hide preview header */
  #preview-header {
    display: none !important;
  }
  
  /* Ensure proper print layout */
  #app {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Enhanced Help Modal Styles */
.help-tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
  gap: 5px;
}

.help-tab {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
  font-size: 14px;
}

.help-tab:hover {
  background: #f5f5f5;
  color: #1976d2;
}

.help-tab.active {
  background: #1976d2;
  color: white;
  font-weight: 600;
}

.help-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.help-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Shortcut Categories */
.shortcut-category {
  margin-bottom: 25px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #1976d2;
}

.shortcut-category h4 {
  margin: 0 0 15px 0;
  color: #1976d2;
  font-size: 16px;
  font-weight: 600;
}

.shortcuts-grid {
  display: grid;
  gap: 20px;
}

/* Markdown Categories */
.markdown-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.markdown-category {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #4caf50;
}

.markdown-category h4 {
  margin: 0 0 15px 0;
  color: #4caf50;
  font-size: 16px;
  font-weight: 600;
}

/* Feature Sections */
.feature-section {
  margin-bottom: 25px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #ff9800;
}

.feature-section h4 {
  margin: 0 0 15px 0;
  color: #ff9800;
  font-size: 16px;
  font-weight: 600;
}

.features-list {
  margin: 0;
  padding-left: 20px;
}

.features-list li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* FAQ Sections */
.faq-section {
  margin-bottom: 25px;
}

.faq-section h4 {
  margin: 0 0 15px 0;
  color: #e91e63;
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 2px solid #e91e63;
}

.faq-item {
  margin-bottom: 20px;
  padding: 15px;
  background: #fff3e0;
  border-radius: 8px;
  border-left: 4px solid #e91e63;
}

.faq-item h5 {
  margin: 0 0 10px 0;
  color: #d32f2f;
  font-size: 14px;
  font-weight: 600;
}

.faq-item p {
  margin: 0;
  color: #666;
  line-height: 1.6;
  font-size: 14px;
}

/* Improved Reference Items */
.ref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
}

.ref-item:hover {
  background: #f0f7ff;
  border-color: #1976d2;
  transform: translateX(5px);
}

.ref-item code {
  background: #f5f5f5;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #d32f2f;
  border: 1px solid #e0e0e0;
  min-width: 150px;
  text-align: left;
}

.ref-item span {
  color: #666;
  font-size: 13px;
  font-weight: 500;
}

/* Dark Mode Support for Help Modal */
body.dark-mode .help-tab {
  color: #ccc;
}

body.dark-mode .help-tab:hover {
  background: #444;
  color: #64b5f6;
}

body.dark-mode .help-tab.active {
  background: #1976d2;
  color: white;
}

body.dark-mode .shortcut-category,
body.dark-mode .markdown-category,
body.dark-mode .feature-section {
  background: #2d2d30;
}

body.dark-mode .faq-item {
  background: #2d2d30;
  color: #ccc;
}

body.dark-mode .faq-item p {
  color: #ccc;
}

body.dark-mode .ref-item {
  background: #2d2d30;
  border-color: #444;
}

body.dark-mode .ref-item:hover {
  background: #333;
  border-color: #64b5f6;
}

body.dark-mode .ref-item code {
  background: #444;
  color: #ff6b6b;
  border-color: #555;
}

body.dark-mode .ref-item span {
  color: #ccc;
}

/* ===================== */
/* CONSOLIDATED MOBILE RESPONSIVE STYLES */
/* ===================== */
@media (max-width: 768px) {
  /* Navbar Styles */
  .navbar-toggle {
    display: flex;
  }
  
  .navbar-container {
    padding: 0.5rem 1rem;
    min-height: 56px;
    gap: 0.75rem;
  }
  
  .logo {
    font-size: 1.1rem;
  }
  
  .navbar-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem 1rem;
    gap: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
  }
  
  .navbar-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 100vh;
  }
  
  .navbar-menu:not(.active) .navbar-item,
  .navbar-menu:not(.active) .dropdown-menu,
  .navbar-menu:not(.active) .export-menu {
    display: none !important;
  }
  
  .navbar-item {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.5rem;
  }
  
  .navbar-item:last-child {
    margin-bottom: 0;
  }
  
  .navbar-btn,
  .navbar-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
  }
  
  .dropdown {
    width: 100%;
  }
  
  .dropdown-toggle {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
  }
  
  .dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    max-height: 0;
    transition: all 0.3s ease;
  }
  
  .dropdown:hover .dropdown-menu,
  .dropdown.active .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    max-height: 300px;
  }
  
  .export-dropdown {
    width: 100%;
    position: relative;
  }
  
  .export-menu {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    top: 100%;
    right: 0;
    left: auto;
    min-width: 180px;
    z-index: 1000;
  }
  
  .export-dropdown:hover .export-menu,
  .export-dropdown.active .export-menu {
    opacity: 1;
    visibility: visible;
    max-height: 300px;
  }
  
  .navbar-input {
    width: 100%;
    max-width: 300px;
  }

  /* Footer Styles */
  .footer-container {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  
  .footer {
    position: static;
    margin-top: auto;
  }
  
  .footer-left p {
    font-size: 0.8rem;
  }
  
  /* Main Layout Styles */
  #app { 
    flex-direction: column !important;
    height: auto;
    min-height: calc(100vh - 60px);
    padding: 5px 0.5rem;
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;
    gap: 0.75rem;
  }
  
  .panel { 
    flex: none !important;
    width: 100% !important;
    height: auto;
    min-height: 280px;
    margin: 0;
    padding: 1rem;
    border-radius: 10px;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  .panel-resizer {
    display: none !important;
  }
  
  #editor-panel {
    order: 1;
    min-height: 400px;
    padding: 1rem;
    gap: 0.75rem;
  }
  
  #preview-panel {
    order: 2;
    min-height: 350px;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  /* Toolbar Styles */
  .toolbar {
    gap: 0.5rem;
    padding: 0.75rem;
  }
  
  .toolbar-header {
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
  }
  
  .toolbar-title {
    font-size: 0.8rem;
  }
  
  .toolbar-master-toggle {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  
  .toolbar-sections .toolbar-section:not(.primary-actions) {
    display: none;
  }
  
  .toolbar.expanded .toolbar-sections .toolbar-section {
    display: flex;
  }
  
  .primary-actions {
    position: relative;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .primary-actions::after {
    content: '👆 Tap toolbar title to see more tools';
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    z-index: 10;
  }
  
  .toolbar.expanded .primary-actions::after {
    content: '👆 Tap toolbar title to hide tools';
  }
  
  .toolbar.collapsed .primary-actions::after {
    display: none;
  }
  
  /* Formatting Toolbar */
  .formatting-toolbar {
    flex-wrap: wrap;
    gap: 0.3rem; /* Compact spacing for mobile */
    padding: 0.6rem; /* Reduced padding */
    border-radius: 6px;
    bottom: auto;
  }
  
  .format-btn {
    font-size: 0.7rem; /* Smaller but readable */
    padding: 0.3rem 0.45rem; /* Very compact */
    min-width: auto;
    border-radius: 4px;
  }
  
  /* Buttons and Inputs */
  .btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
  
  .input-field {
    font-size: 0.875rem;
    padding: 0.5rem;
    margin: 0.125rem;
    flex: 1 1 auto;
    min-width: 120px;
    border-radius: 6px;
  }
  
  /* Editor */
  .editor {
    font-size: 0.9rem;
    min-height: 300px;
    height: auto;
    max-height: 50vh;
    padding: 1rem;
    line-height: 1.6;
    border-radius: 8px;
    resize: none;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-bottom: 2.5rem;
  }
  
  /* Modal Styles */
  .modal-content {
    margin: 5% auto;
    padding: 1rem;
    width: 95%;
    max-height: 85vh;
    border-radius: 6px;
  }
  
  .confirmation-modal {
    max-width: none;
    width: 100%;
    margin: 1rem;
  }
  
  .modal-footer {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .btn-secondary,
  .btn-danger {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
  }
  
  .close {
    top: 0.5rem;
    right: 1rem;
    font-size: 1.5rem;
  }

  /* Help Modal */
  #help-modal .modal-content {
    padding: 1rem;
  }

  .help-section {
    margin-bottom: 1.5rem;
  }

  .help-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .help-tabs {
    flex-wrap: wrap;
    gap: 2px;
  }
  
  .help-tab {
    padding: 8px 12px;
    font-size: 12px;
    flex: 1;
    min-width: calc(50% - 1px);
  }
  
  .markdown-categories {
    grid-template-columns: 1fr;
  }

  .shortcuts-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .shortcut-item {
    padding: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .shortcut-item span {
    text-align: left;
    margin-left: 0;
    font-size: 0.85rem;
  }

  .shortcut-item kbd {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
  }

  .markdown-reference {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .ref-item {
    padding: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .ref-item span {
    text-align: left;
    margin-left: 0;
    font-size: 0.8rem;
  }

  .ref-item code {
    font-size: 0.8rem;
    min-width: auto;
    width: 100%;
  }

  .tips-list li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
  }

  /* Stats Modal */
  #stats-modal .modal-content {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .stat-card {
    padding: 1rem 0.5rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  .stats-details {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .detail-item {
    padding: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .detail-value {
    margin-left: 0;
  }

  .readability-score {
    padding: 1rem;
  }

  .readability-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  /* Notifications */
  .notification-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .notification {
    transform: translateY(-100%);
  }
  
  .notification-show {
    transform: translateY(0);
  }
  
  .notification-hide {
    transform: translateY(-100%);
  }
  
  /* Dark Mode Mobile Specific Styles */
  body.dark-mode .navbar-menu {
    background: linear-gradient(135deg, #0d47a1, #1565c0);
  }
  
  body.dark-mode .dropdown-menu {
    background: rgba(45, 45, 45, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }
}
}

/* Enhanced notification styles with better error handling support */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
  max-width: 400px;
}

.notification {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
  border-left: 4px solid;
  max-width: 100%;
  word-wrap: break-word;
}

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

.notification.notification-hide {
  opacity: 0;
  transform: translateX(100%);
  margin-bottom: 0;
  max-height: 0;
  overflow: hidden;
}

.notification-content {
  padding: 16px;
}

.notification-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.notification-header:only-child {
  margin-bottom: 0;
}

.notification-icon {
  font-size: 18px;
  margin-right: 12px;
  flex-shrink: 0;
  line-height: 1;
}

.notification-title {
  font-weight: 600;
  font-size: 15px;
  margin-right: 12px;
  flex-grow: 1;
  line-height: 1.3;
}

.notification-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.notification-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.notification-body {
  margin-left: 30px;
}

.notification-message {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  display: block;
  margin-bottom: 12px;
}

.notification-message:only-child {
  margin-bottom: 0;
}

.notification-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.notification-action-btn {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notification-action-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

/* Enhanced notification types */
.notification-success .notification-action-btn {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.notification-success .notification-action-btn:hover {
  background: rgba(16, 185, 129, 0.2);
}

.notification-error .notification-action-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #7f1d1d;
}

.notification-error .notification-action-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.notification-warning .notification-action-btn {
  background: rgba(245, 158, 11, 0.1);
  color: #78350f;
}

.notification-warning .notification-action-btn:hover {
  background: rgba(245, 158, 11, 0.2);
}

.notification-info .notification-action-btn {
  background: rgba(59, 130, 246, 0.1);
  color: #1e3a8a;
}

.notification-info .notification-action-btn:hover {
  background: rgba(59, 130, 246, 0.2);
}

/* Error report modal styles */
.error-report-modal .modal-content {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.error-details {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 12px;
  margin: 12px 0;
}

.error-details h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #495057;
}

.error-details pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.user-feedback {
  margin: 12px 0;
}

.user-feedback h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #495057;
}

.user-feedback textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}

/* Safe mode styles */
body.safe-mode {
  filter: grayscale(0.3);
}

body.safe-mode::before {
  content: '🛡️ Safe Mode - Limited Functionality';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fbbf24;
  color: #78350f;
  padding: 8px;
  text-align: center;
  font-weight: bold;
  z-index: 9999;
  font-size: 14px;
}

body.safe-mode .navbar {
  margin-top: 40px;
}

.panel.disabled {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

.panel.disabled::after {
  content: 'Temporarily disabled due to errors';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(239, 68, 68, 0.1);
  color: #7f1d1d;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-weight: 500;
}
