/* Upload Page Styles */
* {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11pt;
}

.markdown-uploader-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2rem;
}

.upload-card {
  background: white;
  border-radius: 1rem;
  padding: 3rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.viewer-turkey-image {
  width: 280px;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem;
  opacity: 0.95;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.3));
}

.upload-card h1 {
  margin: 0 0 0.5rem 0;
  color: #2d3748;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

.upload-card .subtitle {
  color: #4a5568 !important;
  text-align: center;
}

.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.alert-error {
  background-color: #fed7d7;
  color: #c53030;
  border: 1px solid #fc8181;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.file-input-wrapper {
  position: relative;
}

.file-input {
  display: none;
}

.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2rem;
  border: 2px dashed #cbd5e0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f7fafc;
}

.file-label:hover {
  border-color: #667eea;
  background-color: #edf2f7;
}

.upload-icon {
  width: 3rem;
  height: 3rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.file-label-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.file-name {
  font-size: 0.9rem;
  color: #718096;
  margin-top: 0.5rem;
}

.viewer-header-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1.5rem;
}

.home-button {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #667eea;
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background 0.3s ease;
}

.home-button:hover {
  background: #5a67d8;
}

.or-divider {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: #cbd5e0;
}

.or-divider::before {
  left: 0;
}

.or-divider::after {
  right: 0;
}

.or-divider span {
  background: white;
  padding: 0 1rem;
  color: #718096;
  font-weight: 600;
}

.paste-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.paste-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.markdown-textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid #cbd5e0;
  border-radius: 0.5rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.markdown-textarea:focus {
  outline: none;
  border-color: #667eea;
}

.render-button {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.render-button:hover {
  background: #5a67d8;
}

.submit-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

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

/* Viewer Page Styles */
.markdown-viewer-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  background-color: #f7fafc;
}

.viewer-header {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.viewer-header h1 {
  margin: 0;
  color: #2d3748;
  font-size: 1.75rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.edit-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.edit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.export-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.export-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.print-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.print-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.back-link {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: #764ba2;
}

/* Rendered Markdown Content Styles */
.markdown-content {
  background: white;
  padding: 3rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  line-height: 1.7;
  color: #2d3748;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1a202c;
}

.markdown-content h1 {
  font-size: 2.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-top: 0;
}

.markdown-content h2 {
  font-size: 2rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.markdown-content h3 {
  font-size: 1.5rem;
}

.markdown-content h4 {
  font-size: 1.25rem;
}

.markdown-content h5 {
  font-size: 1.1rem;
}

.markdown-content h6 {
  font-size: 1rem;
  color: #4a5568;
}

.markdown-content p {
  margin-bottom: 1rem;
}

.markdown-content a {
  color: #667eea;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.markdown-content a:hover {
  border-bottom-color: #667eea;
}

.markdown-content ul,
.markdown-content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.markdown-content li {
  margin-bottom: 0.5rem;
}

.markdown-content blockquote {
  border-left: 4px solid #667eea;
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: #4a5568;
  font-style: italic;
  background-color: #f7fafc;
  padding: 1rem 1rem 1rem 1.5rem;
  border-radius: 0 0.25rem 0.25rem 0;
}

.markdown-content code {
  background-color: #edf2f7;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: #e83e8c;
}

.markdown-content pre {
  background-color: #2d3748;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-content table th,
.markdown-content table td {
  border: 1px solid #e2e8f0;
  padding: 0.75rem;
  text-align: left;
}

.markdown-content table th {
  background-color: #667eea;
  color: white;
  font-weight: 600;
}

.markdown-content table tr:nth-child(even) {
  background-color: #f7fafc;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.markdown-content hr {
  border: none;
  border-top: 2px solid #e2e8f0;
  margin: 2rem 0;
}

.markdown-content del {
  color: #a0aec0;
}

/* Mermaid Diagram Styles */
.markdown-content .mermaid {
  background-color: #f7fafc;
  padding: 2rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  text-align: center;
}

.markdown-content .mermaid svg {
  max-width: 100%;
  height: auto;
}

.viewer-footer {
  margin-top: 2rem;
  text-align: center;
}

.upload-another-btn {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-another-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

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

/* Edit Page Styles */
.edit-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
  transition: grid-template-columns 0.3s ease;
}

.edit-form {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.editor-wrapper {
  margin-bottom: 1.5rem;
}

.markdown-editor {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.markdown-editor:focus {
  outline: none;
  border-color: #667eea;
}

.edit-actions {
  display: flex;
  gap: 1rem;
}

.save-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

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

.cancel-btn {
  display: inline-block;
  background: #e2e8f0;
  color: #2d3748;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.cancel-btn:hover {
  background: #cbd5e0;
}

.help-toggle-btn {
  background: transparent;
  color: #667eea;
  border: 2px solid #667eea;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.help-toggle-btn:hover {
  background: #667eea;
  color: white;
}

/* Markdown Help Sidebar */
.markdown-help-sidebar {
  position: sticky;
  top: 2rem;
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.markdown-help-sidebar h3 {
  color: #2d3748;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

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

.help-section h4 {
  color: #667eea;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.help-section code {
  display: block;
  background-color: #f7fafc;
  color: #2d3748;
  padding: 0.4rem 0.6rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  border-left: 3px solid #667eea;
  line-height: 1.4;
}

/* Responsive Layout */
@media (max-width: 1024px) {
  .edit-layout {
    grid-template-columns: 1fr;
  }

  .markdown-help-sidebar {
    position: static;
    max-height: none;
  }
}

/* Print Styles */
@media print {
  * {
    font-size: 10pt;
  }

  .viewer-header,
  .viewer-footer,
  .back-link,
  .upload-another-btn {
    display: none !important;
  }

  .markdown-viewer-container {
    max-width: 100%;
    padding: 0;
    background-color: white;
  }

  .markdown-content {
    box-shadow: none;
    padding: 0;
    margin: 0;
    line-height: 1.4;
  }

  /* Smaller headers for print */
  .markdown-content h1 {
    font-size: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }

  .markdown-content h2 {
    font-size: 1.3rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }

  .markdown-content h3 {
    font-size: 1.1rem;
    margin-top: 0.8rem;
    margin-bottom: 0.4rem;
  }

  .markdown-content h4 {
    font-size: 1rem;
    margin-top: 0.8rem;
    margin-bottom: 0.4rem;
  }

  .markdown-content h5 {
    font-size: 0.95rem;
    margin-top: 0.6rem;
    margin-bottom: 0.3rem;
  }

  .markdown-content h6 {
    font-size: 0.9rem;
    margin-top: 0.6rem;
    margin-bottom: 0.3rem;
  }

  /* Reduce spacing in lists */
  .markdown-content ul,
  .markdown-content ol {
    margin-bottom: 0.5rem;
    line-height: 1.2;
  }

  .markdown-content li {
    margin-bottom: 0.2rem;
    line-height: 1.2;
  }

  /* Prevent page breaks inside important elements */
  .markdown-content h1,
  .markdown-content h2,
  .markdown-content h3,
  .markdown-content h4,
  .markdown-content h5,
  .markdown-content h6,
  .markdown-content p,
  .markdown-content blockquote {
    page-break-inside: avoid;
  }

  /* Ensure links show their URLs in print */
  .markdown-content a {
    color: #000;
    text-decoration: underline;
  }

  /* Clean up code blocks for print */
  .markdown-content pre {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .markdown-content pre code {
    color: #000;
  }

  /* Clean up tables for print */
  .markdown-content table th {
    background-color: #f0f0f0;
    color: #000;
    border: 1px solid #000;
  }

  .markdown-content table td {
    border: 1px solid #000;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .markdown-uploader-container {
    padding: 1rem;
  }

  .upload-card {
    padding: 2rem;
  }

  .viewer-turkey-image {
    width: 160px;
  }

  .markdown-viewer-container {
    padding: 1rem;
  }

  .markdown-content {
    padding: 1.5rem;
  }

  .viewer-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
