/* Modern, clean CSS */
:root {
  --primary: #1b0249;
  --primary-hover: #4504ad;
  --gray-light: #f3f4f6;
  --gray-border: #e5e7eb;
  --text-dark: #0d0e0e;
  --text-light: #f0f0f0;
  --bg-light: #edeff1;
}

* {
  max-width: 100vw;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Inter', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg-light);
  color: var(--text-dark);
}

/* Dark Mode */
body.dark-mode {
  --gray-light: #2d2d2d;
  --gray-border: #444;
  --text-dark: var(--text-light);
  --bg-light: #191717;
  background: var(--bg-light);
  color: var(--text-light);
}

/* Main Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;  
}

.main-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: white;
  border-bottom: 1px solid var(--gray-border);
  gap: 16px;
}

.dark-mode .main-toolbar {
  background: #2d2d2d;
}

.editor-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow-y: auto;
  max-height: 80vh;     
  }

/* Editor/Preview Panels */
.editor, .preview {
  padding: 20px;
  border-right: 1px solid var(--gray-border);  
}

.editor {
  background: white;
}

.preview {
  background: var(--gray-light);
  overflow-y: auto;  
}

.dark-mode .editor,
.dark-mode .preview {
  background: #2d2d2d;
  color: var(--text-light);
}

.dark-mode h2 {
  color: #000;
}

.editor-column {  
  padding-right: 5px;
  margin-left: 4px;
  line-height: 1.2em;
}

.preview-column {
  margin: 4px;
  padding-right: 5px;
  }

.preview-header {
    background: #fff;
    padding: 10px;
    border: 5px;
  border-radius: 8px;
  }

  .preview-header:focus,
  .preview-header:hover {
    box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
  }

/* Textarea */
textarea {
  width: 100%;
  height: 80vh;
  border: none;
  resize: none;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 5px;
  outline: none;
  background: transparent;
  color: inherit;
}

/* Buttons */
button {
  padding: 8px 12px;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
  margin-top: 10px;
  padding: 10px;
  background-color: #0078d4;
  font-size: 16px;
  border-radius: 5px;
}

button:focus {
  outline: 3px solid #ffcc00;
}
button:hover {
  background: var(--primary-hover);
}

.export-btn, .report-btn {
  background: var(--primary);
  border: 1px solid var(--gray-border);
}

.pref-btn {
  background: transparent;
  border: 1px solid #012345;
  font-size: 1.2em;
  padding: 4px;
  color: inherit;
  margin-bottom: 2px;
}

.font-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 18px;
}

.preference-panel {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 18px;
}

/* Font Size Classes */
.font-small { font-size: 14px; }
.font-medium { font-size: 16px; }
.font-large { font-size: 18px; }

/* Accessibility Panel */
.accessibility-summary {
  display: none;
  padding: 16px;
  background: white;
  border-radius: 8px;
  margin-top: 20px;
  font-size: 14px;
  border-top: 1px solid var(--gray-border);
  max-height: 40vh;
  overflow-y: auto;
}

.dark-mode .accessibility-summary {
  background: #2d2d2d;
}

#check-accessibility {
  background-color: #dad6d6;  
  color: #000;
}

#check-accessibility:hover,
#check-accessibility:focus {
  background-color: #f0f0f0; 
  color: rgba(0, 0, 0, 0.8);
}

#toggle-contrast {
  background-color: #dad6d6;  
  color: #000;
}

#toggle-contrast:hover,
#toggle-contrast:focus {
  background-color: #f0f0f0; 
  color: rgba(0, 0, 0, 0.8);
}

/* Preview Content */
#preview-content h1, 
#preview-content h2 { 
  margin-top: 0; 
}

#preview-content pre {
  background: rgba(0,0,0,0.1);
  padding: 10px;
  border-radius: 4px;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Auto-fix Buttons */
.auto-fix-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.fix-btn {
  padding: 6px 12px;
  background: var(--primary);
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  #accessibility-summary, 
  #accessibility-summary * {
    visibility: visible;
  }
  #accessibility-summary {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}

@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }
  
  #preview-content, #accessibility-summary {
    width: 100%;
    padding: 0;
    margin: 0;
  }
  
  .standard-section {
    page-break-inside: avoid;
  }
}

/* Contrast Checker */
.contrast-checker-panel {  
  position: fixed;
  bottom: 40px;
  right: 20px;
  width: 310px;
  height: 260px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 16px;
  z-index: 100;
  overflow: hidden;
}

#contrast-checker {
  display: none; 
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.contrast-toggle-btn {
  margin-top: 10px;
  padding: 12px 12px;
  cursor: pointer;
  border: none;
  background-color: #0078d4;
  color: white;
  font-size: 16px;
  border-radius: 5px;
}

.contrast-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.color-picker {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.dark-mode .contrast-checker-panel {
  background: #2d2d2d;
  color: black;
}

/* For the link editing experience */
#markdown-input {
  caret-color: #7c3aed;
}

/* Floating Toolbar */
.floating-toolbar {
  position: fixed;
  display: none;
  background: white;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  padding: 6px;
  gap: 4px;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.floating-toolbar button {
  background: #1b0249;
  color:white;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
}

.floating-toolbar button:hover {
  background: #797c83;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-90%); }
  to { opacity: 1; transform: translateY(-100%); }
}

/* Status Bar */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1b0249;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-item .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-item .indicator.active {
  background: #4ade80;
}

.status-item .indicator.inactive {
  background: #ef4444;
}

#refresh-btn {
  background: var(--primary);
  border: 1px solid var(--gray-border);
  margin-bottom: 4px;
  align-content: center;
}

#refresh-btn:focus,
#refresh-btn:hover {
  background: #4504ad;
}

.skip-link {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #000;
  color: #fff;
  padding: 10px;
  font-size: 16px;
  text-decoration: none;
  z-index: 1000;
  opacity: 0;
}

/* Share buttons for social media */
.share-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.share-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    font-size: 16px;
    color: #000;
    background-color: #dee9f2; /* Microsoft blue */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;    
    transition: background-color 0.3s ease-in-out;
}

.share-button:hover, .share-button:focus {
    background-color: #afbeca;
}

.share-button:focus {
    outline: 2px solid #FFD700; /* High-contrast yellow outline */
}

.skip-link:focus {
  opacity: 1;
}

/* Onboarding tips */
.onboarding-tip {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #fffbe6;
  color: #333;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  max-width: 90vw;
  font-size: 0.95rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dismiss-tip {
  background-color: #fffbe6; /* Soft yellow backdrop for visibility */
  border: 2px solid #f0c36d;
  font-size: 1rem;
  color: #333;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dismiss-tip:hover,
.dismiss-tip:focus {
  background-color: #fef0c2;
  border-color: #e1b648;
  color: #000;
}

.dismiss-tip:focus-visible {
  outline: 3px solid #f0c36d;
  outline-offset: 3px;
}

/* Help Button */
  .help-btn {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 10px 16px;
  font-size: 16px;
  border-radius: 5px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}

.help-btn:hover, .help-btn:focus {
  background-color: #0056b3;
  outline: 3px solid #ffcc00; /* High-contrast focus indicator */
}

/* General mobile layout */
@media (max-width: 768px) {
  /* Clean layout structure */
  .main-toolbar,
  .editor-preview-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-group {
    flex: 1 1 100%;
    text-align: center;
    margin-bottom: 1rem;
  }

  .editor-column,
  .preview-column {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
  }

  .floating-toolbar {
    position: fixed;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #f0f0f0;
    z-index: 999;
  }

  .contrast-checker-panel,
  .accessibility-summary {
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
  }

  .font-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .report-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }

  /* Refined tutorial overlay */
  #tutorial-overlay {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: 1rem;
  padding-right: 1rem;
  font-size: 0.95rem;
  max-width: 95vw;
  max-height: 85vh;
  box-sizing: border-box;
  overflow-y: auto;
  position: fixed;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  z-index: 1000;
  border-radius: 0.5rem;
}

  /* Preview area cleanup */
  .preview-column {
    min-height: 40vh;
    overflow-x: auto;
  }

  .preview-content,
  #preview-content {
    padding: 1rem;
    font-size: 0.95rem;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .toolbar-group button,
  .pref-btn,
  .export-btn,
  .primary-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }

  h2, h3, h4 {
    font-size: 1.2rem;
  }

  #start-btn {
    width: 100%;
    font-size: 1rem;
  }

  /* Optional: tighter tutorial padding */
  #tutorial-overlay {
    padding: 0.75rem;
  }
}
@media only screen and (width: 393px) and (height: 852px) and (-webkit-device-pixel-ratio: 3) {
  /* iPhone 15 / 15 Pro specific styles */
}

