/* Editor LinkedIn - CSS Avançado */

/* Reset CSS */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

body {
  margin: 0 !important;
  padding: 0 !important;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  background: hsl(0, 0%, 2%) !important;
  color: #e1f0ff !important;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Tema claro */
body.light {
  background: #f4f6f8 !important;
  color: #111 !important;
}

body.light .editor-header {
  background: linear-gradient(135deg, rgba(150,185,207,0.2) 0%, rgba(62,94,134,0.2) 100%) !important;
  border-bottom: 1px solid rgba(150,185,207,0.4) !important;
}

body.light .back-btn {
  background: rgba(150,185,207,0.3) !important;
  color: #2c3e50 !important;
  border: 1px solid rgba(150,185,207,0.5) !important;
}

body.light .back-btn:hover {
  background: rgba(150,185,207,0.4) !important;
  color: #1a252f !important;
  box-shadow: 0 0 15px rgba(150,185,207,0.4) !important;
}

body.light .header-left h1 {
  color: #2c3e50 !important;
}

body.light .editor-header button {
  background: rgba(150,185,207,0.3) !important;
  color: #2c3e50 !important;
  border: 1px solid rgba(150,185,207,0.5) !important;
}

body.light .editor-header button:hover {
  background: rgba(150,185,207,0.4) !important;
  color: #1a252f !important;
  box-shadow: 0 0 15px rgba(150,185,207,0.4) !important;
}

body.light .cover-control button {
  background: rgba(150,185,207,0.3) !important;
  color: #2c3e50 !important;
  border: 1px solid rgba(150,185,207,0.5) !important;
}

body.light .cover-control button:hover {
  background: rgba(150,185,207,0.4) !important;
  color: #1a252f !important;
}

body.light .toolbar {
  background: rgba(150,185,207,0.15) !important;
  border-bottom: 1px solid rgba(150,185,207,0.3) !important;
}

body.light .toolbar button,
body.light .toolbar select {
  background: rgba(150,185,207,0.2) !important;
  color: #2c3e50 !important;
  border: 1px solid rgba(150,185,207,0.4) !important;
}

body.light .toolbar button:hover,
body.light .toolbar select:hover {
  background: rgba(150,185,207,0.3) !important;
  color: #1a252f !important;
  box-shadow: 0 0 10px rgba(150,185,207,0.3) !important;
}

body.light .toolbar select option {
  background: #fff !important;
  color: #2c3e50 !important;
}

body.light #contentEditor {
  background: rgba(255,255,255,0.9) !important;
  color: #333 !important;
  border: 1px solid rgba(150,185,207,0.3) !important;
}

body.light #contentEditor:focus {
  box-shadow: 0 0 0 2px rgba(150,185,207,0.5), 0 0 20px rgba(150,185,207,0.3) !important;
}

/* Header */
.editor-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 15px 20px !important;
  background: linear-gradient(135deg, rgba(150,185,207,0.1) 0%, rgba(62,94,134,0.1) 100%) !important;
  border-bottom: 1px solid rgba(150,185,207,0.2) !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(150,185,207,0.15);
  border: 1px solid rgba(150,185,207,0.3);
  border-radius: 8px;
  color: #e1f0ff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(150,185,207,0.25);
  box-shadow: 0 0 15px rgba(150,185,207,0.3);
  transform: translateX(-2px);
}

.back-btn svg {
  transition: transform 0.3s ease;
}

.back-btn:hover svg {
  transform: translateX(-2px);
}

.editor-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-header button {
  padding: 12px 16px;
  font-size: 16px;
  min-height: 44px;
  border: 1px solid rgba(150,185,207,0.3);
  border-radius: 8px;
  background: rgba(150,185,207,0.15);
  color: #e1f0ff;
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.editor-header button:hover {
  background: rgba(150,185,207,0.25);
  box-shadow: 0 0 15px rgba(150,185,207,0.3);
}

/* Controle de capa */
.cover-control {
  padding: 15px 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cover-control button {
  padding: 12px 16px;
  font-size: 16px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: #2d3748;
  color: #e1f0ff;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.cover-control button:hover {
  background: #4a5568;
}

/* Toolbar avançada */
.toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 15px !important;
  background: rgba(150,185,207,0.08) !important;
  border-bottom: 1px solid rgba(150,185,207,0.15) !important;
  overflow-x: auto !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.toolbar button,
.toolbar select {
  padding: 12px 16px;
  font-size: 16px;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid rgba(150,185,207,0.2);
  border-radius: 6px;
  background: rgba(150,185,207,0.1);
  color: #e1f0ff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.toolbar button:hover,
.toolbar select:hover {
  background: rgba(150,185,207,0.2);
  box-shadow: 0 0 10px rgba(150,185,207,0.2);
}

.toolbar select {
  min-width: 120px;
}

.toolbar select option {
  background: #2d3748;
  color: #e1f0ff;
  padding: 8px;
}

/* Tema claro - selects */
body.light .toolbar select {
  background: rgba(150,185,207,0.2) !important;
  color: #2c3e50 !important;
  border: 1px solid rgba(150,185,207,0.4) !important;
}

body.light .toolbar select:hover {
  background: rgba(150,185,207,0.3) !important;
  color: #1a252f !important;
  box-shadow: 0 0 10px rgba(150,185,207,0.3) !important;
}

body.light .toolbar select option {
  background: #fff !important;
  color: #2c3e50 !important;
}

/* Container do editor */
.editor-container {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 15px;
}

/* Área de edição */
#contentEditor {
  min-height: 400px !important;
  background: rgba(150,185,207,0.05) !important;
  padding: 20px !important;
  border-radius: 16px !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  outline: none !important;
  border: 1px solid rgba(150,185,207,0.15) !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  color: #e1f0ff !important;
  font-family: Inter, system-ui, sans-serif !important;
}

#contentEditor:focus {
  box-shadow: 0 0 0 2px rgba(150,185,207,0.4), 0 0 20px rgba(150,185,207,0.2);
}

/* Títulos e subtítulos sempre visíveis */
#contentEditor h2 {
  color: #e1f0ff !important;
  font-size: 1.5rem !important;
  font-weight: bold !important;
  margin: 20px 0 10px 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#contentEditor h3 {
  color: #e1f0ff !important;
  font-size: 1.2rem !important;
  font-weight: bold !important;
  margin: 15px 0 8px 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#contentEditor p {
  color: #e1f0ff !important;
  margin: 10px 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Tema claro */
body.light #contentEditor {
  background: rgba(255,255,255,0.9) !important;
  color: #333 !important;
  border: 1px solid rgba(150,185,207,0.3) !important;
}

body.light #contentEditor:focus {
  box-shadow: 0 0 0 2px rgba(150,185,207,0.5), 0 0 20px rgba(150,185,207,0.3) !important;
}

body.light #contentEditor h2 {
  color: #2d3748 !important;
}

body.light #contentEditor h3 {
  color: #4a5568 !important;
}

body.light #contentEditor p {
  color: #333 !important;
}

/* Preview */
.preview-content {
  display: none;
  min-height: 400px;
  background: white;
  padding: 0;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  font-family: Inter, system-ui;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

.preview-content img:first-child {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 16px 16px 0 0;
}

.preview-content > *:not(img:first-child) {
  padding: 0 30px;
}

.preview-content > *:last-child {
  padding-bottom: 30px;
}

/* Estilos para elementos dentro do editor */
#contentEditor code {
  background: #2d3748;
  color: #e1f0ff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

#contentEditor pre {
  background: #1a2332;
  color: #e1f0ff;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  margin: 10px 0;
  border: 1px solid #2d3748;
}

#contentEditor pre code {
  background: transparent;
  padding: 0;
}

/* Títulos e subtítulos visíveis */
#contentEditor h2 {
  color: #e1f0ff !important;
  font-size: 1.5rem !important;
  font-weight: bold !important;
  margin: 20px 0 10px 0 !important;
}

#contentEditor h3 {
  color: #e1f0ff !important;
  font-size: 1.2rem !important;
  font-weight: bold !important;
  margin: 15px 0 8px 0 !important;
}

/* Tema claro - títulos */
body.light #contentEditor h2 {
  color: #2d3748 !important;
}

body.light #contentEditor h3 {
  color: #4a5568 !important;
}

/* Preview - estilos do conteúdo */
.preview-content pre {
  background: #1a2332;
  color: #e1f0ff;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 15px 0;
}

.preview-content code {
  font-family: 'Courier New', monospace;
  background: #2d3748;
  color: #e1f0ff;
  padding: 2px 6px;
  border-radius: 4px;
}

.preview-content pre code {
  background: transparent;
  padding: 0;
}

.preview-content span[style*="background-color: rgb(0, 0, 0)"],
.preview-content span[style*="background-color: #000000"] {
  background-color: #000000 !important;
  color: #ffffff !important;
  padding: 6px 10px !important;
  border-radius: 4px !important;
  display: inline-block !important;
  margin: 2px !important;
  font-weight: normal !important;
}

.preview-content h2 {
  color: #2d3748;
  margin-top: 30px;
}

.preview-content h3 {
  color: #4a5568;
  margin-top: 25px;
}

.preview-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Imagens inseridas no conteúdo */
#contentEditor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
  display: block;
}

.preview-content div img {
  border-radius: 8px;
  margin: 10px 0;
  display: block;
}

#contentEditor span[style*="background-color: rgb(0, 0, 0)"],
#contentEditor span[style*="background-color: #000000"] {
  background-color: #000000 !important;
  color: #ffffff !important;
  padding: 6px 10px !important;
  border-radius: 4px !important;
  display: inline-block !important;
  margin: 2px !important;
  font-weight: normal !important;
}

/* Botão de editar caixa ativo */
#editBoxBtn {
  transition: all 0.3s ease;
}

/* Estilos para texto indentado */
#contentEditor div[style*="margin-left"] {
  margin: 10px 0;
  transition: margin 0.2s ease;
}

#contentEditor div[style*="border-left"] {
  border-left: 3px solid #4a5568 !important;
  padding-left: 20px !important;
  margin-left: 40px !important;
  background: rgba(74, 85, 104, 0.1);
  border-radius: 0 8px 8px 0;
}

.cover-preview {
  max-width: 100%;
  display: none;
  margin: 20px auto;
  border-radius: 16px;
  padding: 0 15px;
}

/* Media queries para dispositivos móveis */
@media (max-width: 768px) {
  .editor-header {
    padding: 12px 15px;
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-left {
    justify-content: center;
    margin-bottom: 10px;
  }
  
  .editor-header h1 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 10px;
  }
  
  .actions {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .toolbar {
    padding: 12px;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .toolbar button,
  .toolbar select {
    padding: 14px 18px;
    font-size: 16px;
    min-height: 48px;
    min-width: 48px;
    flex-shrink: 0;
  }
  
  .toolbar select {
    min-width: 140px;
  }
  
  .editor-container {
    margin: 15px auto;
    padding: 0 10px;
  }
  
  #contentEditor {
    padding: 15px;
    font-size: 16px;
    min-height: 300px;
    border-radius: 12px;
  }
  
  .preview-content {
    padding: 20px;
    min-height: 300px;
    border-radius: 12px;
  }
  
  .cover-control {
    padding: 12px 15px;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .cover-control button {
    flex: 1;
    min-width: 140px;
    margin: 4px;
  }
}

@media (max-width: 480px) {
  .editor-header {
    padding: 10px 12px;
  }
  
  .header-left {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  
  .back-btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  
  .editor-header h1 {
    font-size: 1.1rem;
    line-height: 1.2;
  }
  
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  
  .editor-header button {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
  }
  
  .toolbar {
    padding: 10px;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .toolbar button,
  .toolbar select {
    padding: 16px 20px;
    font-size: 16px;
    min-height: 50px;
    min-width: 50px;
    flex-shrink: 0;
  }
  
  .toolbar select {
    min-width: 150px;
  }
  
  .editor-container {
    padding: 0 8px;
  }
  
  #contentEditor {
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    min-height: 250px;
  }
  
  .preview-content {
    padding: 15px;
    border-radius: 12px;
    font-size: 16px;
    min-height: 250px;
  }
  
  .cover-control {
    padding: 10px 12px;
    flex-direction: column;
  }
  
  .cover-control button {
    width: 100%;
    margin: 4px 0;
    padding: 14px 18px;
    font-size: 15px;
  }
}

/* Melhorias para touch devices */
@media (hover: none) and (pointer: coarse) {
  .toolbar button,
  .toolbar select,
  .editor-header button,
  .cover-control button {
    min-height: 48px;
    min-width: 48px;
    padding: 14px 18px;
  }
  
  .back-btn {
    min-height: 44px;
    padding: 12px 16px;
  }
}

/* Orientação landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .editor-header {
    padding: 8px 15px;
  }
  
  .editor-header h1 {
    font-size: 1.2rem;
  }
  
  .toolbar {
    padding: 8px;
  }
  
  #contentEditor {
    min-height: 200px;
  }
}

/* Preview com tema */
.article-preview {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.preview-theme-btn {
  transition: all 0.2s ease;
}

.preview-theme-btn:hover {
  background: #357ABD !important;
  transform: scale(1.05);
}