/* ============================================
    WORD TO HTML CLEANER - STYLES
    Matching PicMunk design system
    ============================================ */

:root {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #404040;
  --bg-panel: #1e1e1e;
  --bg-editor-light: #d4d4d4;
  --border-color: #404040;
  --text-primary: #ffffff;
  --text-secondary: #adb5bd;
  --text-editor-dark: #2d2d2d;
  --accent-color: #c55201;
  --accent-success: #66bb6a;
  --accent-hover: #a84501;
  --accent-warning: #f39c12;
  --accent-clean: #9b59b6;
  --accent-clean-hover: #8e44ad;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-strong: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body#word-cleaner {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ============================================
    TABS CONTAINER
    ============================================ */

.tabs-container {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tabs-left {
  display: flex;
  gap: 4px;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(102, 126, 234, 0.05);
}

.tabs-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tab-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.tab-info i {
  color: var(--accent-color);
}

/* ============================================
    APP CONTAINER
    ============================================ */

.app-container {
  min-height: calc(100vh - 120px);
  padding: 24px;
}

.main-container {
  display: flex;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.tab-content {
  display: none;
  height: 100%;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
    SIDEBAR PANEL
    ============================================ */

.sidebar-panel {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.sidebar-section .section-header {
  margin-bottom: 16px;
}

.sidebar-section .section-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

/* Instruction Steps */
.instruction-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.instruction-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.step-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* Features List */
.features-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.feature-item i {
  color: var(--accent-success);
  font-size: 16px;
  flex-shrink: 0;
}

/* Privacy Note */
.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(102, 187, 106, 0.1);
  border-color: var(--accent-success);
}

.privacy-note i {
  color: var(--accent-success);
  font-size: 24px;
  flex-shrink: 0;
}

.privacy-note strong {
  color: var(--text-primary);
  font-size: 14px;
}

.privacy-note small {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

/* HTML Sidebar Styles */
.btn-full {
  width: 100%;
  justify-content: center;
}

.html-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-box {
  background: rgba(102, 187, 106, 0.1);
  border: 2px solid var(--accent-success);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-icon-small {
  font-size: 24px;
  color: var(--accent-success);
  flex-shrink: 0;
}

.stats-text-small {
  flex: 1;
}

.stats-text-small strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 24px 16px;
}

/* Content Panel */
.content-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================================
    VISUAL EDITOR TAB
    ============================================ */

.editor-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.editor-wrapper {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Simple Toolbar Styling */
.simple-toolbar {
  background: var(--bg-secondary);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.toolbar-btn:active,
.toolbar-btn.active {
  background: rgba(13, 110, 253, 0.2);
  color: var(--accent-color);
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
}

/* ContentEditable Editor */
.content-editor {
  flex: 1;
  padding: 20px;
  min-height: 500px;
  overflow-y: auto;
  background: var(--bg-editor-light);
  color: var(--text-editor-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  outline: none;
}

.content-editor:empty:before {
  content: attr(data-placeholder);
  color: #4a4a4a;
  opacity: 1;
}

/* Styled content inside editor */
.content-editor p {
  margin: 0 0 1em 0;
}

.content-editor ul,
.content-editor ol {
  margin: 0 0 1em 0;
  padding-left: 2em;
}

.content-editor li {
  margin-bottom: 0.5em;
}

.content-editor a {
  color: #0d6efd;
  text-decoration: underline;
}

.content-editor strong,
.content-editor b {
  font-weight: 600;
}

.content-editor em,
.content-editor i {
  font-style: italic;
}

.content-editor u {
  text-decoration: underline;
}

/* ============================================
    HTML CODE TAB
    ============================================ */

.html-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.html-code-block {
  width: 100%;
  flex: 1;
  min-height: 400px;
  margin: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  overflow: auto;
  transition: border-color 0.2s;
  cursor: text;
  user-select: text;
}

.html-code-block:focus-within {
  outline: none;
  border-color: var(--accent-color);
}

.html-code-block code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
    "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  display: block;
  white-space: pre;
  user-select: text;
}

/* Prism.js Theme Overrides */
.token.comment {
  color: #6a9955;
}

.token.tag {
  color: #569cd6;
}

.token.attr-name {
  color: #9cdcfe;
}

.token.attr-value {
  color: #ce9178;
}

.token.punctuation {
  color: #d4d4d4;
}

/* ============================================
    BUTTONS
    ============================================ */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn i {
  font-size: 16px;
}

.btn-clean {
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
  padding: 12px 28px;
  font-size: 15px;
}

.btn-clean:hover {
  background: linear-gradient(135deg, #0b5ed7, #0d6efd);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
  transform: translateY(-1px);
}

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

.btn-clean:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #0d6efd;
  color: #ffffff;
}

.btn-primary:hover {
  background: #0b5ed7;
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--accent-success);
  color: #ffffff;
}

.btn-secondary:hover {
  background: #57a85a;
  transform: translateY(-1px);
}

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

.btn-success {
  background: var(--accent-success);
  color: #ffffff;
}

.btn-success i {
  animation: checkPulse 0.5s ease;
}

@keyframes checkPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* ============================================
    TOAST NOTIFICATION
    ============================================ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-primary);
  border: 2px solid var(--accent-success);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-strong);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

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

.toast.success {
  border-color: var(--accent-success);
}

.toast.success i {
  color: var(--accent-success);
  font-size: 24px;
}

.toast-message {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
    RESPONSIVE DESIGN
    ============================================ */

@media (max-width: 1024px) {
  .main-container {
    flex-direction: column;
  }

  .sidebar-panel {
    width: 100%;
    position: static;
    max-height: none;
    order: 2;
    margin-top: 24px;
  }

  .content-panel {
    order: 1;
  }
}

@media (max-width: 768px) {
  .tabs-container {
    padding: 0 12px;
    flex-wrap: wrap;
  }

  .tab {
    padding: 12px 16px;
    font-size: 14px;
  }

  .tab-info {
    font-size: 12px;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
    margin-bottom: 8px;
  }

  .app-container {
    padding: 16px;
  }

  .sidebar-section {
    padding: 16px;
  }

  .instruction-step {
    gap: 10px;
  }

  .step-number {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .html-code-block {
    font-size: 12px;
    padding: 16px;
    min-height: 300px;
  }

  .html-code-block code {
    font-size: 12px;
  }

  .ql-editor {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .tab {
    padding: 10px 12px;
    font-size: 13px;
  }

  .tab i {
    display: none;
  }

  .toast {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }
}

/* ============================================
    LOADING STATE
    ============================================ */

.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}
