:root {
  /* Light mode - Soft neumorphic palette */
  --bg-color: #e8ecf1;
  --text-color: #2d3748;
  --text-secondary: #718096;
  --accent-color: #1e40af;
  --accent-gradient: linear-gradient(135deg, #1e40af 0%, #07275a 100%);
  --card-bg-color: #e8ecf1;
  --shadow-light: #ffffff;
  --shadow-dark: #d1d9e6;
  --success-color: #48bb78;
  --error-color: #f56565;
  --warning-color: #ed8936;
}

html {
  height: 100%;
  height: -webkit-fill-available; /* Safari support */
  overflow-x: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  background: linear-gradient(135deg, #e8ecf1 0%, #f0f3f7 100%);
  background-attachment: fixed; /* Prevent white space on mobile */
  color: var(--text-color);
  transition: all 0.3s ease;
  font-weight: 400;
  letter-spacing: -0.01em;
  min-height: 100vh;
  min-height: -webkit-fill-available; /* Safari support */
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

.dark-mode body {
  background: #0f1419;
  background-attachment: fixed;
}

h1 {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
}

/* App Container - CSS Grid Layout */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
  transition: grid-template-columns 0.3s ease;
  width: 100%;
  max-width: 100vw;
}

.app-container.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

/* Header Styles */
header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg-color);
  color: var(--text-color);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mode Switcher */
.mode-switcher {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.mode-button {
  background: var(--card-bg-color);
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.mode-button:hover {
  color: var(--accent-color);
  transform: translateY(-1px);
}

.mode-button.active-mode {
  color: var(--accent-color);
  background: var(--accent-gradient);
  color: white;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.2),
    inset -2px -2px 4px rgba(255, 255, 255, 0.1);
}

.mode-button i {
  font-size: 16px;
}

/* Sidebar Styles */
.sidebar {
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  box-shadow: inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  overflow-y: auto;
  overflow-x: hidden;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed {
  width: 0;
  overflow: hidden;
}

.sidebar-content {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* Character Count Card */
.char-count-card {
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 5px 5px 10px var(--shadow-dark),
    -5px -5px 10px var(--shadow-light);
}

.char-count-header {
  margin-bottom: 16px;
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.char-count-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

#sidebar-char-count {
  font-size: 48px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.char-limit-display {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--card-bg-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.progress-fill.warning {
  background: linear-gradient(135deg, var(--warning-color), #f59e0b);
}

.progress-fill.danger {
  background: linear-gradient(135deg, var(--error-color), #dc2626);
}

.remaining-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Platform Presets */
.platform-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.platform-dropdown {
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg-color);
  color: var(--text-color);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.platform-dropdown:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* Quick Stats */
.quick-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.quick-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.quick-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
}

/* Show More Button */
.show-more-button {
  width: 100%;
  padding: 10px;
  background: var(--card-bg-color);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.show-more-button:hover {
  color: var(--accent-color);
  transform: translateY(-1px);
}

.show-more-button.expanded i {
  transform: rotate(180deg);
}

/* Detailed Stats */
.detailed-stats {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.detailed-stats.show {
  display: flex;
}

.detailed-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.detailed-stat-row span:last-child {
  font-weight: 600;
  color: var(--text-color);
}

/* Sidebar Actions */
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.action-button {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
  width: 100%;
}

.export-button {
  background: linear-gradient(135deg, var(--accent-color), #3b82f6);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  justify-content: space-between;
}

.export-button:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.export-button:active {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.export-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: hidden;
}

.export-menu.show {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.export-option {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.export-option:last-child {
  border-bottom: none;
}

.export-option:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--accent-color);
  transform: none;
  box-shadow: none;
}

.export-option:active {
  background: rgba(102, 126, 234, 0.15);
  transform: none;
  box-shadow: none;
}

.export-option i {
  font-size: 16px;
  width: 20px;
}

/* Dark mode export dropdown */
.dark-mode .export-menu {
  background: rgba(26, 31, 38, 0.98);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .export-option {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-mode .export-option:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.dark-mode .export-option:active {
  background: rgba(99, 102, 241, 0.2);
}

/* Collapse Button */
.collapse-button {
  width: 100%;
  padding: 8px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-color);
  transition: all 0.2s ease;
}

.collapse-button:hover {
  background: rgba(102, 126, 234, 0.15);
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.collapse-button:active {
  transform: translateY(0);
}

.dark-mode .collapse-button {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.dark-mode .collapse-button:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
}

/* Floating Badge (when sidebar collapsed) */
.floating-badge {
  display: none;
  position: fixed;
  left: 20px;
  top: 120px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(102, 126, 234, 0.3);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 100;
  transition: all 0.3s ease;
}

.sidebar-collapsed .floating-badge {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.floating-badge-count {
  text-align: center;
}

#floating-char-count {
  font-size: 32px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}

#floating-char-limit {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
}

.expand-button {
  background: var(--card-bg-color);
  border: none;
  color: var(--accent-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.expand-button:hover {
  transform: scale(1.05);
}

/* Workspace */
.dark-mode .workspace {
  background: #0f1419;
}

.workspace {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

.mode-workspace {
  display: none;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.mode-workspace.active {
  display: flex;
}

textarea {
  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - 300px);
  padding: 20px;
  font-size: 15px;
  font-family: inherit;
  border: none;
  border-radius: 20px;
  resize: none;
  background-color: var(--card-bg-color);
  color: var(--text-color);
  box-sizing: border-box;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06),
    inset 0 -1px 2px rgba(255, 255, 255, 0.1);
}

/* Markdown Mode Styles */
.markdown-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: calc(100vh - 300px);
}

.markdown-editor-pane,
.markdown-preview-pane {
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 5px 5px 10px var(--shadow-dark),
    -5px -5px 10px var(--shadow-light);
}

.pane-header {
  padding: 12px 20px;
  background: var(--card-bg-color);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

/* Markdown Toolbar */
.markdown-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--card-bg-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-wrap: wrap;
}

.toolbar-button {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--card-bg-color);
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.toolbar-button:hover {
  color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.toolbar-button:active {
  transform: translateY(0);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.toolbar-button sub {
  font-size: 9px;
  margin-left: -2px;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: rgba(0, 0, 0, 0.1);
  margin: 0 4px;
}

/* Dark mode toolbar */
.dark-mode .markdown-toolbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-mode .toolbar-button {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.dark-mode .toolbar-button:hover {
  color: #818cf8;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.dark-mode .toolbar-button:active {
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.03);
}

.dark-mode .toolbar-separator {
  background: rgba(255, 255, 255, 0.1);
}

#markdown-input {
  flex: 1;
  min-height: unset;
  border-radius: 0;
  box-shadow: none;
}

#markdown-preview {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--card-bg-color);
  color: var(--text-color);
}

.markdown-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding-top: 16px;
}

textarea:focus {
  outline: none;
  box-shadow: inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light), 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.dark-mode textarea:focus {
  box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.3),
    inset -4px -4px 8px rgba(255, 255, 255, 0.05),
    0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Removed old .stats and .stat-card styles - now in sidebar */

button {
  padding: 12px 28px;
  background: var(--card-bg-color);
  color: var(--text-color);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
}

button:active {
  transform: translateY(0);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.copy-button {
  background: linear-gradient(135deg, var(--success-color), #38a169);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-button:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-button:active {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clear-button {
  background: linear-gradient(135deg, var(--error-color), #e53e3e);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clear-button:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clear-button:active {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Textarea wrapper for floating badge */
.textarea-wrapper {
  position: relative;
  margin-bottom: 20px;
}

/* Floating limits badge - Glassmorphism */
.limits-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(102, 126, 234, 0.3);
  color: var(--accent-color);
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.limits-badge:hover {
  background: rgba(102, 126, 234, 0.2);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dark-mode .limits-badge {
  background: rgba(26, 31, 38, 0.7);
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  color: #818cf8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dark-mode .limits-badge:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.limits-badge i {
  font-size: 14px;
}

#limits-badge-text {
  font-size: 12px;
}

/* Expandable limits panel - Glassmorphism */
.limits-expanded {
  position: absolute;
  top: 60px;
  right: 15px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 20px;
  padding: 0;
  width: 340px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.limits-expanded.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.limits-expanded-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(
    145deg,
    rgba(232, 236, 241, 0.6),
    rgba(240, 243, 247, 0.6)
  );
  border-radius: 20px 20px 0 0;
}

.limits-expanded-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
}

.limits-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-color);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
  box-shadow: none;
}

.limits-close:hover {
  opacity: 1;
  background: none;
  transform: none;
  box-shadow: none;
}

.limits-expanded-content {
  padding: 20px;
}

.limit-input-group {
  margin-bottom: 20px;
}

.limit-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.limit-input-group input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  background-color: var(--card-bg-color);
  color: var(--text-color);
  transition: border-color 0.2s ease;
}

.limit-input-group input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-color);
}

.limit-input-group input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    to right,
    var(--accent-color) 0%,
    var(--accent-color) 0%,
    #ddd 0%,
    #ddd 100%
  );
  border-radius: 3px;
  outline: none;
}

.limit-input-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.limit-input-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.limit-input-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.limit-input-group input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode limit panel */
.dark-mode .limits-expanded {
  background: rgba(26, 31, 38, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dark-mode .limits-expanded-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    145deg,
    rgba(26, 31, 38, 0.8),
    rgba(22, 27, 33, 0.8)
  );
}

.dark-mode .limit-input-group input[type="number"] {
  border: 1px solid rgba(99, 102, 241, 0.3);
  background-color: rgba(15, 20, 25, 0.6);
}

.dark-mode .limit-input-group input[type="range"] {
  background: linear-gradient(
    to right,
    var(--accent-color) 0%,
    var(--accent-color) 0%,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="range"] {
  width: 100%;
}

.limit-warning {
  color: var(--error-color);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(245, 101, 101, 0.1);
  display: none;
}

.limit-warning:not(:empty) {
  display: block;
}

textarea.limit-exceeded {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06),
    inset -8px -8px 16px var(--shadow-light), 0 0 0 2px var(--error-color);
}

/* Dark Mode Styles - Clean, Modern */
.dark-mode {
  --bg-color: #0f1419;
  --text-color: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  --card-bg-color: #1a1f26;
  --shadow-light: rgba(255, 255, 255, 0.03);
  --shadow-dark: rgba(0, 0, 0, 0.4);
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
}

/* Subtle gradient background for depth - DARKER */
.dark-mode body {
  background: linear-gradient(135deg, #0f1419 0%, #151b22 100%);
}

/* Old stat-card styles removed - sidebar now handles stats */

.dark-mode header {
  background: var(--bg-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-mode footer {
  box-shadow: 5px 5px 10px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  background: linear-gradient(145deg, #1a1f26, #161b21);
}

.dark-mode button {
  box-shadow: 5px 5px 10px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.dark-mode button:hover {
  box-shadow: 7px 7px 14px var(--shadow-dark),
    -5px -5px 10px var(--shadow-light);
}

.dark-mode .theme-button,
.dark-mode #settings-button {
  box-shadow: 4px 4px 8px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.dark-mode .theme-button.active-theme {
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

/* Duplicate header styles removed - using new styles above */

.theme-button {
  background: var(--card-bg-color);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 10px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.theme-button:hover {
  color: var(--accent-color);
  transform: translateY(-2px);
}

.theme-button.active-theme {
  color: var(--accent-color);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

#settings-button {
  background: var(--card-bg-color);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 10px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

#settings-button:hover {
  color: var(--accent-color);
  transform: translateY(-2px);
}

footer {
  text-align: center;
  padding: 12px;
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  color: var(--text-secondary);
  font-size: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
}

footer p {
  margin: 0;
  font-weight: 500;
}

footer p:first-child {
  margin-bottom: 8px;
  color: #1e40af;
}

.footer-privacy {
  font-size: 12px;
  font-weight: 300;
  margin: 0 auto;
  line-height: 1.4;
}

/* Install App Section in Settings */
.install-section {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.install-app-button {
  width: 100%;
  padding: 14px 20px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-top: 8px;
}

.install-app-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.install-app-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.install-app-button i {
  font-size: 16px;
}

.install-description {
  margin: 12px 0 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  text-align: center;
}

.dark-mode .install-app-button {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .install-app-button:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode footer {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

/* Settings Panel Styles - Modern Neumorphic Design */
dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  max-width: 480px;
  width: 90%;
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.dark-mode dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.dialog-header {
  padding: 24px 28px;
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

dialog h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dialog-close {
  background: var(--card-bg-color);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.dialog-close:hover {
  color: var(--accent-color);
  transform: scale(1.05);
}

.dialog-close:active {
  transform: scale(0.95);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.dialog-content {
  padding: 20px 28px 28px;
}

/* Settings Sections */
.settings-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

/* Settings Row - for horizontal layout */
.settings-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.setting-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  flex: 1;
}

.setting-group-small {
  flex: 0 0 120px;
  max-width: 120px;
}

.settings-row:not(:last-child) {
  margin-bottom: 16px;
}

.theme-options-row {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  margin-bottom: 20px;
}

.setting-group > label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.dark-mode .settings-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-group input[type="number"],
.setting-group select {
  padding: 12px 16px;
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card-bg-color);
  color: var(--text-color);
  transition: all 0.2s ease;
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.setting-group input[type="number"]:focus,
.setting-group select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light), 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.theme-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.theme-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  background: var(--card-bg-color);
  border: 2px solid rgba(102, 126, 234, 0.3);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
  margin: 0;
}

.theme-option input[type="radio"]:checked {
  border-color: var(--accent-color);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.theme-option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gradient);
}

.theme-option span {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-color);
}

.settings-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.settings-buttons button {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
}

#save-settings-button {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 4px 4px 8px var(--shadow-dark),
    -4px -4px 8px var(--shadow-light);
}

#save-settings-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
}

#save-settings-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Settings Mobile Responsive */
@media (max-width: 600px) {
  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .setting-group-small {
    max-width: 100%;
    flex: 1;
  }

  dialog {
    width: 95%;
    max-width: 95%;
  }

  .dialog-content {
    padding: 16px 20px 20px;
  }

  .section-title {
    font-size: 13px;
  }
}

/* Dark Mode Settings Dialog */
.dark-mode dialog {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .dialog-header {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dark-mode .setting-group input[type="number"],
.dark-mode .setting-group select {
  background: rgba(15, 20, 25, 0.6);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.03);
}

.dark-mode .setting-group input[type="number"]:focus,
.dark-mode .setting-group select:focus {
  border-color: var(--accent-color);
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.03),
    0 0 0 3px rgba(99, 102, 241, 0.2);
}

.dark-mode .theme-option input[type="radio"] {
  background: rgba(15, 20, 25, 0.6);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.03);
}

.dark-mode .settings-buttons {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dark-mode #save-settings-button {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 5px 5px 10px var(--shadow-dark),
    -4px -4px 8px var(--shadow-light);
}

.dark-mode #save-settings-button:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 7px 7px 14px var(--shadow-dark),
    -5px -5px 10px var(--shadow-light);
}

/* Floating Stats Overlay */
.stats-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.stats-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.stats-overlay-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-overlay.show .stats-overlay-content {
  transform: scale(1) translateY(0);
}

.stats-overlay-header {
  padding: 24px 28px;
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-overlay-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-overlay-header h3 i {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stats-overlay-close {
  background: var(--card-bg-color);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.stats-overlay-close:hover {
  color: var(--accent-color);
  transform: scale(1.05);
}

.stats-overlay-close:active {
  transform: scale(0.95);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.stats-overlay-body {
  padding: 28px;
  overflow-y: auto;
  max-height: calc(85vh - 100px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: linear-gradient(145deg, #e8ecf1, #f0f3f7);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  transition: transform 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stats-section {
  margin-bottom: 28px;
}

.stats-section:last-child {
  margin-bottom: 0;
}

.stats-section h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-section h4 i {
  color: var(--accent-color);
  font-size: 18px;
}

/* Word Frequency List */
.word-frequency-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.word-frequency-item {
  background: var(--card-bg-color);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
  transition: all 0.2s ease;
}

.word-frequency-item:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.word-text {
  font-weight: 600;
  color: var(--text-color);
  font-size: 14px;
}

.word-count {
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

/* Dark Mode Stats Overlay */
.dark-mode .stats-overlay-content {
  background: rgba(26, 31, 38, 0.98);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .stats-overlay-header {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dark-mode .stat-box {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.dark-mode .word-frequency-item {
  background: rgba(15, 20, 25, 0.6);
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.dark-mode .word-frequency-item:hover {
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

/* Toast Notification Styles */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
}

.toast {
  background-color: var(--card-bg-color);
  color: var(--text-color);
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  animation: slideIn 0.3s ease-out;
  border-left: 4px solid var(--accent-color);
}

.toast.toast-success {
  border-left-color: #28a745;
}

.toast.toast-error {
  border-left-color: #dc3545;
}

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

.toast.toast-warning {
  border-left-color: #ffc107;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  color: #28a745;
}

.toast-error .toast-icon {
  color: #dc3545;
}

.toast-info .toast-icon {
  color: var(--accent-color);
}

.toast-warning .toast-icon {
  color: #ffc107;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-color);
  opacity: 0.5;
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
  background: none;
}

.toast.toast-exit {
  animation: slideOut 0.3s ease-in forwards;
}

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

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Dark mode toast adjustments */
.dark-mode .toast {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile responsiveness for toasts */
@media (max-width: 600px) {
  #toast-container {
    left: 10px;
    right: 10px;
    top: 10px;
    max-width: none;
  }

  .toast {
    min-width: auto;
  }

  .limits-expanded {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .limits-badge {
    font-size: 11px;
    padding: 6px 10px;
  }

  #limits-badge-text {
    font-size: 10px;
  }
}

/* Dark Mode Sidebar & New Component Styles */
.dark-mode .sidebar {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  box-shadow: inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
}

.dark-mode .char-count-card {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  box-shadow: 5px 5px 10px var(--shadow-dark),
    -5px -5px 10px var(--shadow-light);
}

.dark-mode .quick-stat-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-mode .platform-dropdown {
  background: rgba(15, 20, 25, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.dark-mode .floating-badge {
  background: rgba(26, 31, 38, 0.9);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dark-mode .markdown-editor-pane,
.dark-mode .markdown-preview-pane {
  background: linear-gradient(145deg, #1a1f26, #161b21);
  box-shadow: 5px 5px 10px var(--shadow-dark),
    -5px -5px 10px var(--shadow-light);
}

.dark-mode #markdown-preview {
  background: rgba(15, 20, 25, 0.6);
}

.dark-mode .textarea-wrapper {
  background: transparent;
}

.dark-mode #text-input {
  background: linear-gradient(145deg, #1a1f26, #161b21);
}

.dark-mode #markdown-input {
  background: rgba(15, 20, 25, 0.6);
}

.dark-mode .mode-button {
  background: var(--card-bg-color);
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.dark-mode .mode-button.active-mode {
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.05);
}

/* Mobile Menu Button - Hidden on Desktop */
.mobile-menu-button {
  display: none;
}

/* Mobile FAB - Hidden on Desktop */
.mobile-fab {
  display: none;
}

.fab-menu {
  display: none;
}

/* Responsive Styles - Mobile */
@media (max-width: 768px) {
  /* Mobile FAB */
  .mobile-fab {
    display: block;
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 1000;
  }

  .fab-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .fab-button:active {
    transform: scale(0.95);
  }

  .fab-button.active {
    transform: rotate(90deg);
  }

  /* FAB Quick Menu */
  .fab-menu {
    position: fixed;
    bottom: 158px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
  }

  .fab-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
  }

  .fab-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 28px;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
      inset 2px 2px 4px var(--shadow-light),
      inset -2px -2px 4px var(--shadow-dark);
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 120px;
  }

  .fab-menu-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
  }

  .fab-menu-item:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
      inset 1px 1px 2px var(--shadow-dark),
      inset -1px -1px 2px var(--shadow-light);
  }
  /* Hide hamburger, theme buttons, and settings from header on mobile */
  .mobile-menu-button,
  #light-mode-button,
  #dark-mode-button,
  #settings-button {
    display: none !important;
  }

  /* Stack sidebar below header on mobile */
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .sidebar.expanded-mobile {
    max-height: 400px;
    overflow-y: auto;
  }

  .app-container.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  header {
    padding: 16px 20px;
  }

  .header-top h1 {
    font-size: 24px;
  }

  .mode-switcher {
    flex-wrap: wrap;
    gap: 8px;
  }

  .mode-button {
    padding: 8px 16px;
    font-size: 13px;
  }

  .workspace {
    padding: 16px 20px;
  }

  /* Markdown split becomes vertical stack on mobile */
  .markdown-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: auto;
  }

  textarea {
    min-height: calc(100vh - 400px);
  }

  .floating-badge {
    left: 10px;
    top: 80px;
  }

  /* Hide collapse button on mobile */
  .collapse-button {
    display: none;
  }

  /* Stats Overlay as Bottom Sheet on Mobile */
  .stats-overlay-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .stats-overlay.show .stats-overlay-content {
    transform: translateY(0);
  }

  .stats-overlay-body {
    max-height: calc(85vh - 80px);
  }
}

/* Custom Confirmation Dialog */
.confirm-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.confirm-overlay.show {
  display: flex;
}

.confirm-dialog {
  background: var(--bg-color);
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: confirmSlideUp 0.3s ease;
}

@keyframes confirmSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.confirm-dialog h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
}

.confirm-dialog p {
  margin: 0 0 24px 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
}

.confirm-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-cancel {
  background: var(--card-bg-color);
  color: var(--text-color);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.confirm-cancel:hover {
  background: rgba(0, 0, 0, 0.05);
}

.confirm-ok {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.confirm-ok:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.dark-mode .confirm-dialog {
  background: #1a1f26;
}

.dark-mode .confirm-cancel {
  background: #2d3748;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .confirm-cancel:hover {
  background: #374151;
}
