/* ==========================================================================
   TabNotes Pro - Monochrome Minimalist Design System for Galaxy Tab
   ========================================================================== */

:root {
  /* Ultra-Minimalist Monochrome Palette - Dark Mode (Default) */
  --bg-primary: #09090b;
  --bg-secondary: #121215;
  --bg-tertiary: #1c1c21;
  --bg-glass: rgba(9, 9, 11, 0.92);
  --bg-glass-card: rgba(18, 18, 21, 0.85);
  --border-color: #27272a;
  --border-focus: #ffffff;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent-primary: #ffffff;
  --accent-primary-hover: #e4e4e7;
  --accent-secondary: #a1a1aa;
  --accent-gradient: none;

  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Minimal Shadows & Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-glow: none;

  /* Crisp Sharp Radius & Fast Transitions */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;

  --sidebar-width: 260px;
}

/* Minimalist Light Theme Overrides */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f4f4f5;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-glass-card: #ffffff;
  --border-color: #e4e4e7;
  --border-focus: #09090b;

  --text-primary: #09090b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;

  --accent-primary: #09090b;
  --accent-primary-hover: #27272a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-glow: none;
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  user-select: none;
  touch-action: manipulation;
}

#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Header Bar */
.app-header {
  height: 54px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 50;
}

.search-bar-container {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin: 0 1rem;
}

.search-input {
  width: 100%;
  padding: 0.45rem 1rem 0.45rem 2.4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 60;
  position: relative;
  pointer-events: auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.status-badge.offline {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.icon-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 60;
  transition: var(--transition-fast);
}


.icon-btn *, .btn-primary * {
  pointer-events: none;
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border: 1px solid var(--accent-primary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

/* Sidebar Component */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
  z-index: 40;
}

.sidebar-header {
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.create-note-group {
  padding: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.create-btn {
  padding: 0.55rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.create-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-primary);
}

.nav-section {
  padding: 0.5rem 0.85rem;
  flex: 1;
  overflow-y: auto;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-list, .nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
  font-weight: 600;
}

.folder-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
}

/* Main Workspace */
.main-content {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg-primary);
}

/* Notes Cards Grid */
.notes-grid-view {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  align-content: start;
}

.note-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
  min-height: 160px;
}

.note-card:hover {
  border-color: var(--text-secondary);
  transform: translateY(-1px);
}

.note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.note-card-type-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.note-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.note-card-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  flex: 1;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 0.4rem;
}

/* Full Editor View Container */
.editor-container {
  flex: 1;
  height: calc(100% - 54px);
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

.editor-header-bar {
  padding: 0.6rem 1rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.editor-title-input {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  outline: none;
  flex: 1;
}

/* Canvas / Drawing Toolbar */
.canvas-wrapper {
  flex: 1;
  position: relative;
  background-color: var(--bg-primary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawing-canvas {
  touch-action: none;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: crosshair;
}

.floating-toolbar {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow-md);
  z-index: 30;
}

.tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tool-btn:hover, .tool-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.color-picker-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
}

.color-picker-dot:hover, .color-picker-dot.active {
  transform: scale(1.15);
  border-color: var(--text-primary);
}

/* Rich Text & Markdown Editor */
.text-editor-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  max-width: 850px;
  margin: 0 auto;
  width: 100%;
}

.text-toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
}

.text-area-editable {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text-primary);
  font-size: 0.98rem;
  line-height: 1.65;
  outline: none;
  font-family: var(--font-family);
  overflow-y: auto;
  min-height: 320px;
}

.text-area-editable[contenteditable]:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}

.text-area-editable h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.6rem 0 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.text-area-editable h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0.5rem 0 0.3rem 0;
}

.text-area-editable h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.4rem 0 0.2rem 0;
}

.text-area-editable ul, 
.text-area-editable ol {
  padding-left: 1.5rem;
  margin: 0.4rem 0;
}

.text-area-editable blockquote {
  border-left: 4px solid var(--border-focus);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.text-area-editable pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.88rem;
  overflow-x: auto;
}

.text-area-editable .wysiwyg-task {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.3rem 0;
}

.text-area-editable .wysiwyg-task input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--text-primary);
}

/* Excel Online / Google Sheets Style Spreadsheet Editor */
.spreadsheet-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem 1rem;
}

.excel-toolbar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
}

.excel-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.excel-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.excel-btn:hover {
  background: var(--bg-primary);
  border-color: var(--border-focus);
}

.excel-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.excel-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 0.2rem;
}

.excel-formula-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
}

.excel-cell-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 55px;
  text-align: center;
  border-right: 1px solid var(--border-color);
  padding-right: 0.5rem;
}

.excel-fx-icon {
  font-family: var(--font-mono);
  font-weight: bold;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

.excel-formula-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.spreadsheet-table-container {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  position: relative;
}

.spreadsheet-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.84rem;
}

.spreadsheet-table th, .spreadsheet-table td {
  border: 1px solid var(--border-color);
  padding: 0;
  height: 28px;
  position: relative;
}

.spreadsheet-table th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.spreadsheet-table td input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  padding: 0 0.5rem;
  font-family: inherit;
  font-size: 0.84rem;
}

.spreadsheet-table td input.cell-active {
  border: 2px solid var(--text-primary) !important;
  background: var(--bg-tertiary) !important;
  z-index: 10;
  position: relative;
}

.spreadsheet-table td input.cell-selected {
  background: rgba(161, 161, 170, 0.18) !important;
}

.spreadsheet-table td input.cell-formula-target {
  border: 2px dashed #3b82f6 !important;
  background: rgba(59, 130, 246, 0.14) !important;
  z-index: 15;
  position: relative;
}

/* Excel Bottom Status Bar */
.excel-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.excel-stat-pills {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-weight: 600;
}

.excel-stat-pill {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Board / Sticky Notes Editor */
.board-workspace {
  flex: 1;
  padding: 1.25rem;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-content: start;
}

.sticky-note {
  border-radius: var(--radius-md);
  padding: 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition-fast);
}

.sticky-note textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 0.88rem;
  color: inherit;
  line-height: 1.4;
}

/* Sticky Note Color Tints & Dots */
.sticky-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.sticky-color-dot:hover {
  transform: scale(1.25);
}

.sticky-color-dot.active {
  transform: scale(1.25);
  border-color: var(--text-primary) !important;
}

.sticky-note[data-card-color="yellow"] {
  background: #fef9c3 !important;
  color: #713f12 !important;
}
.sticky-note[data-card-color="yellow"] textarea,
.sticky-note[data-card-color="yellow"] input {
  color: #713f12 !important;
}

.sticky-note[data-card-color="green"] {
  background: #f0fdf4 !important;
  color: #14532d !important;
}
.sticky-note[data-card-color="green"] textarea,
.sticky-note[data-card-color="green"] input {
  color: #14532d !important;
}

.sticky-note[data-card-color="blue"] {
  background: #eff6ff !important;
  color: #1e3a8a !important;
}
.sticky-note[data-card-color="blue"] textarea,
.sticky-note[data-card-color="blue"] input {
  color: #1e3a8a !important;
}

.sticky-note[data-card-color="purple"] {
  background: #faf5ff !important;
  color: #581c87 !important;
}
.sticky-note[data-card-color="purple"] textarea,
.sticky-note[data-card-color="purple"] input {
  color: #581c87 !important;
}

.sticky-note[data-card-color="red"] {
  background: #fef2f2 !important;
  color: #7f1d1d !important;
}
.sticky-note[data-card-color="red"] textarea,
.sticky-note[data-card-color="red"] input {
  color: #7f1d1d !important;
}

[data-theme="dark"] .sticky-note[data-card-color="yellow"] {
  background: #2a2512 !important;
  color: #fef08a !important;
}
[data-theme="dark"] .sticky-note[data-card-color="yellow"] textarea,
[data-theme="dark"] .sticky-note[data-card-color="yellow"] input {
  color: #fef08a !important;
}

[data-theme="dark"] .sticky-note[data-card-color="green"] {
  background: #12281a !important;
  color: #bbf7d0 !important;
}
[data-theme="dark"] .sticky-note[data-card-color="green"] textarea,
[data-theme="dark"] .sticky-note[data-card-color="green"] input {
  color: #bbf7d0 !important;
}

[data-theme="dark"] .sticky-note[data-card-color="blue"] {
  background: #112238 !important;
  color: #bfdbfe !important;
}
[data-theme="dark"] .sticky-note[data-card-color="blue"] textarea,
[data-theme="dark"] .sticky-note[data-card-color="blue"] input {
  color: #bfdbfe !important;
}

[data-theme="dark"] .sticky-note[data-card-color="purple"] {
  background: #26142c !important;
  color: #e9d5ff !important;
}
[data-theme="dark"] .sticky-note[data-card-color="purple"] textarea,
[data-theme="dark"] .sticky-note[data-card-color="purple"] input {
  color: #e9d5ff !important;
}

[data-theme="dark"] .sticky-note[data-card-color="red"] {
  background: #2b1313 !important;
  color: #fecdd3 !important;
}
[data-theme="dark"] .sticky-note[data-card-color="red"] textarea,
[data-theme="dark"] .sticky-note[data-card-color="red"] input {
  color: #fecdd3 !important;
}

/* Expandable Sticky Note Modal Dialog */
.sticky-modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 92%;
  max-width: 720px;
  height: 80vh;
  max-height: 700px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-xl);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sticky-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.6rem;
}

.sticky-modal-title {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  font-weight: 700;
  color: inherit;
  outline: none;
  flex: 1;
}

.sticky-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sticky-modal-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.6;
  color: inherit;
  width: 100%;
  height: 100%;
}

.sticky-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.6rem;
}

.sticky-modal-card[data-card-color="yellow"] {
  background: #fef9c3 !important;
  color: #713f12 !important;
}
.sticky-modal-card[data-card-color="yellow"] textarea,
.sticky-modal-card[data-card-color="yellow"] input {
  color: #713f12 !important;
}

.sticky-modal-card[data-card-color="green"] {
  background: #f0fdf4 !important;
  color: #14532d !important;
}
.sticky-modal-card[data-card-color="green"] textarea,
.sticky-modal-card[data-card-color="green"] input {
  color: #14532d !important;
}

.sticky-modal-card[data-card-color="blue"] {
  background: #eff6ff !important;
  color: #1e3a8a !important;
}
.sticky-modal-card[data-card-color="blue"] textarea,
.sticky-modal-card[data-card-color="blue"] input {
  color: #1e3a8a !important;
}

.sticky-modal-card[data-card-color="purple"] {
  background: #faf5ff !important;
  color: #581c87 !important;
}
.sticky-modal-card[data-card-color="purple"] textarea,
.sticky-modal-card[data-card-color="purple"] input {
  color: #581c87 !important;
}

.sticky-modal-card[data-card-color="red"] {
  background: #fef2f2 !important;
  color: #7f1d1d !important;
}
.sticky-modal-card[data-card-color="red"] textarea,
.sticky-modal-card[data-card-color="red"] input {
  color: #7f1d1d !important;
}

[data-theme="dark"] .sticky-modal-card[data-card-color="yellow"] {
  background: #3a2e10 !important;
  color: #fef08a !important;
}
[data-theme="dark"] .sticky-modal-card[data-card-color="yellow"] textarea,
[data-theme="dark"] .sticky-modal-card[data-card-color="yellow"] input {
  color: #fef08a !important;
}

[data-theme="dark"] .sticky-modal-card[data-card-color="green"] {
  background: #143322 !important;
  color: #bbf7d0 !important;
}
[data-theme="dark"] .sticky-modal-card[data-card-color="green"] textarea,
[data-theme="dark"] .sticky-modal-card[data-card-color="green"] input {
  color: #bbf7d0 !important;
}

[data-theme="dark"] .sticky-modal-card[data-card-color="blue"] {
  background: #12284c !important;
  color: #bfdbfe !important;
}
[data-theme="dark"] .sticky-modal-card[data-card-color="blue"] textarea,
[data-theme="dark"] .sticky-modal-card[data-card-color="blue"] input {
  color: #bfdbfe !important;
}

[data-theme="dark"] .sticky-modal-card[data-card-color="purple"] {
  background: #2b173e !important;
  color: #e9d5ff !important;
}
[data-theme="dark"] .sticky-modal-card[data-card-color="purple"] textarea,
[data-theme="dark"] .sticky-modal-card[data-card-color="purple"] input {
  color: #e9d5ff !important;
}

[data-theme="dark"] .sticky-modal-card[data-card-color="red"] {
  background: #2b1313 !important;
  color: #fecdd3 !important;
}
[data-theme="dark"] .sticky-modal-card[data-card-color="red"] textarea,
[data-theme="dark"] .sticky-modal-card[data-card-color="red"] input {
  color: #fecdd3 !important;
}

/* Modal Windows */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  padding: 0.55rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
}

/* Responsive queries - Exact requested order for tablet/mobile */
@media (max-width: 768px) {
  #app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
  }

  .sidebar {
    display: contents;
  }

  .main-content {
    display: contents;
  }

  /* 1. Top Logo Header */
  .sidebar-header {
    order: 1;
    width: 100%;
    background: var(--bg-primary);
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-color);
  }

  /* 2. Search & Header Actions Bar (Search, Refresh, Theme, Account) ON ONE ELEGANT ROW */
  .app-header {
    order: 2;
    width: 100%;
    height: 48px;
    padding: 0.35rem 0.6rem;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
  }

  .search-bar-container {
    margin: 0;
    flex: 1;
    min-width: 90px;
    max-width: 210px;
  }

  .search-input {
    padding: 0.3rem 0.45rem 0.3rem 1.7rem;
    font-size: 0.75rem;
    height: 30px;
  }

  .search-icon {
    left: 0.45rem;
    font-size: 0.7rem;
  }

  .header-actions {
    width: auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .status-badge {
    padding: 0.2rem 0.4rem;
    font-size: 0.68rem;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .btn-primary {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  /* 3. 4 Creation Buttons (Kreslení, Text, Tabulka, Nástěnka) */
  .create-note-group {
    order: 3;
    width: 100%;
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
    border-bottom: 1px solid var(--border-color);
  }

  .create-btn {
    padding: 0.45rem 0.2rem;
    font-size: 0.72rem;
    flex-direction: row;
    justify-content: center;
    gap: 0.3rem;
  }

  /* 4. Subfolders Tree Bar (Comfortable 140px height for tablet/mobile) */
  .nav-section {
    order: 4;
    width: 100%;
    background: var(--bg-primary);
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 140px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border-color);
  }

  .section-title {
    font-size: 0.68rem;
    margin: 0.15rem 0 0.1rem 0;
  }

  .nav-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .folder-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.25rem;
    margin-top: 0.15rem;
  }

  .nav-item {
    padding: 0.32rem 0.65rem !important;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-item.subfolder-item {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--text-secondary);
    margin-left: 0.4rem;
    width: calc(100% - 0.4rem);
  }

  .nav-item.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
  }

  .nav-item.active * {
    color: var(--bg-primary) !important;
  }

  .delete-folder-btn {
    display: inline-block;
  }

  /* 5. Main Workspace Views */
  #workspace-view {
    order: 5;
    width: 100%;
    flex: 1;
  }

  .notes-grid-view {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    padding: 0.85rem;
  }
}
