/* ==========================================================================
   UPSC INDIA — CORE APPLICATION & NOTES WORKSPACE STYLES
   ========================================================================== */

:root {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  font-size: var(--type-body);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ==========================================================================
   AUTHENTICATION CARD (#auth)
   ========================================================================== */
#auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--color-bg);
  padding: var(--space-4);
}

.auth-card {
  background: var(--color-surface);
  padding: 40px;
  width: min(440px, 94vw);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  text-align: left;
}

.auth-card .brand {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  margin-bottom: var(--space-4);
}

.auth-card h1 {
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 var(--space-2);
}

.auth-card p {
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

.auth-card form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.auth-card form input {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.exam-picker { border: 1px solid var(--color-border, #d8dce3); border-radius: 10px; padding: 10px 12px; margin: 0 0 var(--space-4); min-width: 0; }
.exam-picker legend { font-size: 13px; font-weight: 600; padding: 0 6px; color: var(--color-text-secondary); }
.exam-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.exam-cats button { min-height: 32px; padding: 2px 10px; font-size: 13px; border-radius: 16px; }
.exam-cats button[aria-pressed="true"] { background: var(--color-primary); color: #fff; }
.exam-list { max-height: 170px; overflow: auto; }
.auth-card form .exam-list label { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; padding: 6px 2px; }
.auth-card form .exam-list input { display: inline-block; width: auto; margin: 0; }
.exam-picked { font-size: 12px; margin: 6px 0 0; color: var(--color-text-secondary); }

#submit {
  width: 100%;
  min-height: 44px;
  margin-top: var(--space-2);
}

.google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin: var(--space-4) 0 0;
  border: 1px solid var(--color-border, #d0d7e2);
  border-radius: 10px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #1f2937);
  font-weight: 600;
  text-decoration: none;
}
.google-signin[hidden], .google-or[hidden] { display: none; }
.google-signin:hover { background: var(--color-primary-light); }
.google-g { font-weight: 800; color: #4285f4; font-size: 18px; line-height: 1; }
.google-or { display: flex; align-items: center; gap: 10px; margin: var(--space-3) 0; font-size: 12px; color: var(--color-text-secondary); }
.google-or::before, .google-or::after { content: ""; flex: 1; border-top: 1px solid var(--color-border, #d0d7e2); }

.auth-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.auth-actions button {
  min-height: 38px;
  font-size: 13px;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  box-shadow: none;
  padding: 4px 8px;
}

.auth-actions button:hover {
  background: var(--color-primary-light);
}

.auth-legal {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
}

.auth-legal a {
  color: var(--color-text-secondary);
  padding: 2px 4px;
}

.auth-legal a:hover {
  color: var(--color-primary);
}

#auth-error {
  color: var(--color-danger);
  font-size: 13px;
  margin-top: var(--space-3);
  text-align: center;
}

/* ==========================================================================
   NOTES WORKSPACE 3-COLUMN LAYOUT (Notion & Craft Inspired Architecture)
   ========================================================================== */
#notes-mobile-tools {
  display: none !important;
}

#notes-main {
  display: grid;
  grid-template-columns: 240px 340px minmax(0, 1fr);
  height: calc(100dvh - var(--header-height));
  box-sizing: border-box;
  background: var(--color-bg);
  overflow: hidden;
  position: relative;
}

.notes-page-heading {
  display: none !important;
}

/* ==========================================================================
   PANE A: COLLECTIONS & SUBJECTS SIDEBAR
   ========================================================================== */
#sidebar,
.notes-collections-pane {
  background: var(--color-surface-alt);
  border-right: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  user-select: none;
}

.collections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-2) var(--space-1);
}

.collections-eyebrow,
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

#add-subject {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#add-subject:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.collections-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item,
#sidebar > button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover,
#sidebar > button:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.nav-item.active,
#sidebar > button.active {
  background: var(--color-surface) !important;
  color: var(--color-primary) !important;
  font-weight: 600 !important;
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}

.nav-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.collections-divider {
  height: 1px;
  background: var(--color-border);
  margin: 6px var(--space-1);
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px var(--space-2);
  margin: 0;
}

.collections-groups-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.group-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 1px 0;
  padding-left: calc(var(--folder-depth, 0) * 12px);
  position: relative;
}

.group-row > button:first-child {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.group-row > button:first-child:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.group-row > button:first-child.active {
  background: var(--color-surface) !important;
  color: var(--color-primary) !important;
  font-weight: 600;
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}

.folder-tools summary {
  list-style: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--color-muted);
  border-radius: var(--radius-xs);
}

.folder-tools summary::-webkit-details-marker {
  display: none;
}

.folder-tools summary:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.folder-tools[open] {
  position: relative;
}

.folder-tools[open] button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  margin-top: 2px;
  cursor: pointer;
}

.sidebar-help {
  margin-top: auto;
  padding: var(--space-4) var(--space-2) var(--space-1);
  color: var(--color-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* ==========================================================================
   PANE B: NOTES EXPLORER LIST
   ========================================================================== */
#list,
.notes-explorer-pane {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.list-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-4) var(--space-4) var(--space-3);
  gap: var(--space-2);
}

.explorer-title-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-heading h2,
#view-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.015em;
}

.explorer-summary,
#summary {
  font-size: 12px;
  color: var(--color-muted);
  margin: 0;
}

.btn-new-note,
#new {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-new-note:hover,
#new:hover {
  background: var(--color-primary-hover);
}

.explorer-controls {
  padding: 0 var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

#search {
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  transition: all 0.15s ease;
}

#search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.filters {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.filters select,
#tag-filter,
#sort-filter {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
}

.fav-filter-pill,
#fav-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.fav-filter-pill:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.notes-scroll-list,
#notes {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-3);
}

.note-card {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.note-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-alt);
  box-shadow: var(--shadow-sm);
}

.note-card.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  box-shadow: 0 2px 4px rgba(28, 103, 229, 0.12);
}

.note-card strong,
.note-card-title {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card p,
.note-card-preview {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 6px 0;
}

.note-card small,
.note-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-muted);
  font-size: 11px;
}

.note-card-subject {
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   PANE C: DOCUMENT WRITING CANVAS & EDITOR
   ========================================================================== */
#editor-panel,
.notes-editor-pane {
  background: var(--color-surface);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.editor-empty-state,
#empty {
  text-align: center;
  margin: auto;
  max-width: 440px;
  padding: var(--space-8) var(--space-4);
  color: var(--color-muted);
}

.empty-icon-wrap,
#empty > span {
  font-size: 40px;
  display: inline-block;
  margin-bottom: var(--space-2);
  line-height: 1;
}

.editor-empty-state h2,
#empty h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 var(--space-2) 0;
  color: var(--color-text);
}

.editor-empty-state p,
#empty p {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin: 0 0 var(--space-4) 0;
}

#empty-create-note {
  height: 38px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

#empty-create-note:hover {
  background: var(--color-primary-hover);
}

.shortcut-hint {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: var(--space-3) !important;
}

.shortcut-hint kbd {
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.editor-active-canvas,
#editing {
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.btn-editor-back,
#editor-back {
  display: none;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  color: var(--color-text-secondary);
  cursor: pointer;
}

#save-state {
  margin-right: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-focus);
}

.editor-actions-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-actions-cluster button,
.editor-top button:not(#editor-back) {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-actions-cluster button:hover,
.editor-top button:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

/* Document Title */
.document-title-input,
#title {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  padding: 4px 0;
  margin: 0 0 var(--space-3) 0;
  box-shadow: none !important;
}

.document-title-input::placeholder,
#title::placeholder {
  color: var(--color-placeholder);
}

/* Metadata Bar */
.document-metadata-bar,
.metadata {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
}

.meta-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-muted);
}

.metadata select,
#location {
  min-height: 32px;
  max-width: 200px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 12.5px;
}

.metadata input[type="text"],
#tags {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 12.5px;
  min-width: 160px;
}

.meta-toggles {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.toggle-pill:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

/* Formatting Toolbar */
.document-toolbar,
#toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-xs);
}

.document-toolbar select,
#heading {
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 500;
}

.document-toolbar button {
  min-height: 28px;
  min-width: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.document-toolbar button:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
}

.toolbar-separator {
  width: 1px;
  height: 18px;
  background: var(--color-border);
  margin: 0 4px;
}

/* Document Body Writing Area */
.document-body-content,
#body {
  min-height: 480px;
  padding: var(--space-2) 0;
  line-height: 1.85;
  font-size: 16px;
  color: var(--color-text);
  outline: none;
  margin-bottom: var(--space-6);
}

.document-body-content h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 22px 0 10px 0;
  color: var(--color-text);
}

.document-body-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 18px 0 8px 0;
  color: var(--color-text);
}

.document-body-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 16px 0 6px 0;
  color: var(--color-text);
}

.document-body-content p {
  margin: 0 0 14px 0;
}

.document-body-content blockquote {
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface-subtle);
  padding: 8px 16px;
  margin: 16px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
  font-style: normal;
}

.document-body-content ul,
.document-body-content ol {
  padding-left: 24px;
  margin: 0 0 14px 0;
}

.document-body-content li {
  margin-bottom: 4px;
}

.document-body-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.document-body-content th,
.document-body-content td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
}

.document-body-content th {
  background: var(--color-surface-sunken);
  font-weight: 600;
}

/* Document Footer */
.document-footer,
footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-muted);
  margin-top: auto;
}

.footer-metric {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 500;
}

.footer-spacer {
  flex: 1;
}

.btn-trash-action,
#delete {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-trash-action:hover,
#delete:hover {
  background: var(--color-surface-sunken);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-restore-action,
#restore {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
}

.btn-danger-action,
#permanent {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--color-danger);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
}

/* Distraction-Free Focus Mode */
#notes-main.focus-mode {
  grid-template-columns: 1fr !important;
}

#notes-main.focus-mode #sidebar,
#notes-main.focus-mode #list,
#notes-main.focus-mode .notes-page-heading {
  display: none !important;
}

#notes-main.focus-mode #editor-panel {
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}

/* Toast Message */
#message {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
}

/* Print Overrides */
@media print {
  #auth, header, #sidebar, #list, .editor-top, .metadata, #toolbar, footer, #message, #notes-mobile-tools {
    display: none !important;
  }
  #notes-main {
    display: block;
    height: auto;
  }
  #editor-panel {
    overflow: visible;
    padding: 0;
  }
  #title {
    font-size: 24px;
    color: #000;
  }
  #body {
    color: #000;
  }
}

/* ==========================================================================
   TABLET RESPONSIVE (760px to 1024px)
   ========================================================================== */
@media (max-width: 1024px) and (min-width: 760px) {
  #notes-main {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  #sidebar {
    display: none;
  }

  #sidebar.open {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }

  #list {
    min-width: 0;
  }

  #editor-panel {
    min-width: 0;
    padding: var(--space-4);
  }

  .editor-active-canvas,
  #editing {
    padding: var(--space-4) var(--space-5);
  }
}

/* ==========================================================================
   MOBILE RESPONSIVE (<= 759px)
   ========================================================================== */
@media (max-width: 759px) {
  #notes-main {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
  }

  #sidebar {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 100;
    box-shadow: var(--shadow-xl);
    background: var(--color-surface);
  }

  #sidebar.open {
    display: flex;
  }

  #list {
    min-height: 260px;
    max-height: 380px;
    border-bottom: 1px solid var(--color-border);
    border-right: none;
  }

  #editor-panel {
    flex: 1;
    min-height: 60vh;
    padding: var(--space-4) var(--space-3);
  }

  .editor-active-canvas,
  #editing {
    padding: var(--space-4) var(--space-2);
  }

  .document-title-input,
  #title {
    font-size: 22px;
  }
}
