/* ===============================
   Global Reset
================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===============================
   Body
================================ */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  font-weight: 400; /* IMPORTANT FIX */
}

/* ===============================
   Container
================================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* ===============================
   Header
================================ */

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

.title {
  font-size: 32px;
  font-weight: 700; /* Heading only */
  margin-bottom: 10px;
}

.subtitle {
  font-size: 16px;
  opacity: 0.95;
  font-weight: 400;
}

/* ===============================
   Main Layout
================================ */

.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

.editor-section,
.output-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* ===============================
   Toolbar
================================ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.toolbar-group {
  display: flex;
  gap: 4px;
}

.toolbar-divider {
  width: 1px;
  background: #d0d0d0;
  margin: 0 4px;
}

.toolbar-btn {
  padding: 8px 12px;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500; /* UI only */
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.toolbar-btn:active {
  transform: scale(0.95);
}

.toolbar-select {
  padding: 8px 12px;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}

.file-upload-btn {
  padding: 8px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

/* ===============================
   Editor
================================ */

.editor {
  min-height: 900px;
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400; /* CRITICAL FIX */
  overflow-y: auto;
}

.editor:focus {
  outline: none;
  border-color: #667eea;
}

.editor[contenteditable]:empty:before {
  content: attr(placeholder);
  color: #999;
}

/* Paragraphs */
.editor p {
  text-align: justify;
  text-align-last: left;
  word-spacing: normal;
  hyphens: auto;
  margin-bottom: 12px;
  font-weight: 400; /* CRITICAL FIX */
}

/* Headings */
.editor h2 {
  text-align: center;
  margin: 20px 0;
  font-size: 24px;
  font-weight: 700;
}

.editor h3,
.editor h4,
.editor h5,
.editor h6 {
  text-align: left;
  margin: 16px 0;
  font-weight: 600;
}

/* Lists */
.editor ul,
.editor ol {
  margin: 12px 0;
  padding-left: 40px;
}

.editor li {
  margin-bottom: 8px;
  font-weight: 400;
}

/* ===============================
   Character Count
================================ */

.character-count {
  text-align: right;
  font-size: 14px;
  color: #666;
  padding: 8px 0;
  font-weight: 400;
}

/* ===============================
   Output Section
================================ */

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.output-header h2 {
  font-size: 20px;
  color: #333;
  font-weight: 600;
}

.output-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

/* ===============================
   HTML Output
================================ */

.html-output {
  min-height: 900px;
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  resize: vertical;
}

/* ===============================
   Dialog
================================ */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
}

.dialog-header h3 {
  font-size: 20px;
  font-weight: 600;
}

.form-group label {
  font-weight: 600;
}

.form-input {
  font-weight: 400;
}

/* ===============================
   Toast
================================ */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  z-index: 2000;
}

.toast.success {
  background: #28a745;
}

.toast.error {
  background: #dc3545;
}
