/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #fbbc04;
  --bg-color: #fff;
  --bg-secondary: #ffffff;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border-color: #e0e0e0;
  --shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 2px 6px 2px rgba(60,64,67,0.15);
  --shadow-hover: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
  --header-height: 64px;
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;

  /* Note colors */
  --note-default: #fff;
  --note-red: #f28b82;
  --note-orange: #fbbc04;
  --note-yellow: #fff475;
  --note-green: #ccff90;
  --note-teal: #a7ffeb;
  --note-blue: #cbf0f8;
  --note-darkblue: #aecbfa;
  --note-purple: #d7aefb;
  --note-pink: #fdcfe8;
  --note-brown: #e6c9a8;
  --note-gray: #e8eaed;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-color);
  color: var(--text-primary);
  border: none;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.btn-primary:hover {
  box-shadow: var(--shadow);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

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

.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  color: var(--text-secondary);
}

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

.icon-btn-small {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.icon-btn-small .material-icons {
  font-size: 18px;
}

/* Auth Screen */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #fef7e0 0%, #fff 100%);
}

.auth-container {
  background: white;
  padding: 48px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-logo .logo-text {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color), #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
}

.auth-logo h1 {
  font-size: 32px;
  font-weight: 400;
  display: none;
}

.auth-form h2 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 24px;
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}

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

.auth-form .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  margin-top: 8px;
}

.auth-switch {
  margin-top: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.auth-switch a {
  color: #1a73e8;
  text-decoration: none;
}

.error-message {
  background-color: #fce8e6;
  color: #c5221f;
  padding: 12px 16px;
  border-radius: 4px;
  margin-top: 16px;
  font-size: 14px;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.logo .logo-text {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color), #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.logo-text {
  font-size: 22px;
  color: var(--text-secondary);
}

.search-bar {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 48px;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
  background-color: var(--bg-color);
  box-shadow: var(--shadow);
}

.search-bar .material-icons {
  color: var(--text-secondary);
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  padding: 12px;
  font-size: 16px;
  outline: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 120px;
  justify-content: flex-end;
}

.user-menu {
  position: relative;
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 4px;
  box-shadow: var(--shadow);
  min-width: 200px;
  z-index: 2000;
  overflow: hidden;
  max-height: 80vh;
  overflow-y: auto;
}

#more-menu {
  position: fixed;
}

.dropdown button {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: none;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.dropdown button:hover {
  background-color: var(--bg-secondary);
}

.user-info {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#user-name {
  font-weight: 500;
}

#user-email {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Main Container */
.main-container {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--bg-color);
  padding: 8px 0;
  overflow-y: auto;
  transition: width 0.2s;
  z-index: 50;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .nav-text {
  display: none;
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  cursor: pointer;
  border-radius: 0 24px 24px 0;
  margin-right: 12px;
  transition: background-color 0.2s;
}

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

.nav-item.active {
  background-color: #fef7e0;
}

.nav-item .material-icons {
  color: var(--text-secondary);
}

.nav-item.active .material-icons {
  color: var(--text-primary);
}

.nav-text {
  font-size: 14px;
  font-weight: 500;
}

.nav-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 8px 0;
}

/* Content */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  transition: margin-left 0.2s;
}

.sidebar.collapsed + .content {
  margin-left: var(--sidebar-collapsed);
}

/* Note Input */
.note-input-container {
  max-width: 600px;
  margin: 0 auto 32px;
}

.note-input {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.note-input.collapsed {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: text;
  gap: 12px;
}

.note-input.collapsed span:first-child {
  color: var(--text-secondary);
}

.note-input.collapsed > span:nth-child(2) {
  flex: 1;
  color: var(--text-secondary);
}

.input-actions {
  display: flex;
  gap: 4px;
}

.note-input.expanded {
  padding: 12px 16px;
}

.note-input.expanded input,
.note-input.expanded textarea {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  resize: none;
  font-family: inherit;
}

.note-input.expanded #note-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.note-input.expanded #note-content {
  min-height: 46px;
}

.note-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

/* Images Preview */
.images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.images-preview .image-preview {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.images-preview .image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.images-preview .image-preview .remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.images-preview .image-preview .remove-image .material-icons {
  font-size: 16px;
}

/* Notes Grid */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.notes-grid.list-view {
  grid-template-columns: 1fr;
  max-width: 600px;
  margin: 0 auto;
}

.section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-left: 8px;
}

.notes-section {
  margin-bottom: 32px;
}

/* Note Card */
.note-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  padding-bottom: 40px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.note-card:hover {
  box-shadow: var(--shadow-hover);
}

.note-card.selected {
  border-color: var(--text-primary);
}

.note-card .note-images {
  margin: -12px -16px 12px;
  display: flex;
  flex-wrap: wrap;
}

.note-card .note-images img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
}

.note-card .note-drawing {
  margin: -12px -16px 12px;
}

.note-card .note-drawing img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: #f8f9fa;
}

.note-card .note-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  word-break: break-word;
}

.note-card .note-content {
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-word;
  max-height: 200px;
  overflow: hidden;
  white-space: pre-wrap;
}

.note-card .checklist-preview {
  list-style: none;
  font-size: 14px;
}

.note-card .checklist-preview li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.note-card .checklist-preview li.checked {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.note-card .checklist-preview li .material-icons {
  font-size: 18px;
  color: var(--text-secondary);
}

.note-card .note-collaborators {
  display: flex;
  margin-top: 12px;
  gap: -8px;
}

.note-card .collaborator-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 2px solid white;
  margin-left: -8px;
}

.note-card .collaborator-avatar:first-child {
  margin-left: 0;
}

.note-card .note-actions {
  display: none;
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: inherit;
  padding: 4px 0;
  flex-wrap: wrap;
}

.note-card:hover .note-actions {
  display: flex;
  gap: 2px;
}

.note-card .pin-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
}

.note-card:hover .pin-btn,
.note-card .pin-btn.pinned {
  opacity: 1;
}

/* Note Colors */
.note-card[data-color="default"] { background-color: var(--note-default); }
.note-card[data-color="red"] { background-color: var(--note-red); border-color: var(--note-red); }
.note-card[data-color="orange"] { background-color: var(--note-orange); border-color: var(--note-orange); }
.note-card[data-color="yellow"] { background-color: var(--note-yellow); border-color: var(--note-yellow); }
.note-card[data-color="green"] { background-color: var(--note-green); border-color: var(--note-green); }
.note-card[data-color="teal"] { background-color: var(--note-teal); border-color: var(--note-teal); }
.note-card[data-color="blue"] { background-color: var(--note-blue); border-color: var(--note-blue); }
.note-card[data-color="darkblue"] { background-color: var(--note-darkblue); border-color: var(--note-darkblue); }
.note-card[data-color="purple"] { background-color: var(--note-purple); border-color: var(--note-purple); }
.note-card[data-color="pink"] { background-color: var(--note-pink); border-color: var(--note-pink); }
.note-card[data-color="brown"] { background-color: var(--note-brown); border-color: var(--note-brown); }
.note-card[data-color="gray"] { background-color: var(--note-gray); border-color: var(--note-gray); }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-state .material-icons {
  font-size: 120px;
  opacity: 0.1;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
}

/* Trash Notice */
.trash-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.note-modal-content {
  position: relative;
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  padding: 0 20px;
  transition: all 0.3s ease;
}

.note-modal-content.fullscreen {
  max-width: 100%;
  max-height: 100%;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.note-modal-content.fullscreen .modal-footer {
  
  bottom: 0;
  left: 0;
  background: inherit;
  box-sizing: border-box;
}

.note-modal-content.fullscreen #modal-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 60px;
}

.fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: #5f6368;
  transition: background 0.2s;
  z-index: 10;
}

.fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.note-modal-content #modal-content-wrapper {
  max-height: none;
  overflow: visible;
}

.note-modal-content input,
.note-modal-content textarea {
  width: 100%;
  border: none;
  outline: none;
  padding: 12px 16px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
  background: transparent;
}

.note-modal-content #modal-title {
  font-size: 18px;
  font-weight: 500;
  padding-top: 16px;
}

.note-modal-content #modal-content {
  min-height: 40px;
  height: auto;
  overflow: hidden;
}

.modal-images {
  display: flex;
  flex-wrap: wrap;
}

.modal-images img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}

.modal-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-color);
}

.edited-time {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.modal-toolbar {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
}

/* Note Modal Colors */
.note-modal-content[data-color="default"] { background-color: var(--note-default); }
.note-modal-content[data-color="red"] { background-color: var(--note-red); }
.note-modal-content[data-color="orange"] { background-color: var(--note-orange); }
.note-modal-content[data-color="yellow"] { background-color: var(--note-yellow); }
.note-modal-content[data-color="green"] { background-color: var(--note-green); }
.note-modal-content[data-color="teal"] { background-color: var(--note-teal); }
.note-modal-content[data-color="blue"] { background-color: var(--note-blue); }
.note-modal-content[data-color="darkblue"] { background-color: var(--note-darkblue); }
.note-modal-content[data-color="purple"] { background-color: var(--note-purple); }
.note-modal-content[data-color="pink"] { background-color: var(--note-pink); }
.note-modal-content[data-color="brown"] { background-color: var(--note-brown); }
.note-modal-content[data-color="gray"] { background-color: var(--note-gray); }

/* Color Picker */
.color-picker {
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 144px;
  z-index: 400;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.color-option:hover {
  border-color: var(--text-primary);
}

.color-option.selected {
  border-color: var(--text-primary);
}

.color-option[data-color="default"] { background-color: var(--note-default); border-color: var(--border-color); }
.color-option[data-color="red"] { background-color: var(--note-red); }
.color-option[data-color="orange"] { background-color: var(--note-orange); }
.color-option[data-color="yellow"] { background-color: var(--note-yellow); }
.color-option[data-color="green"] { background-color: var(--note-green); }
.color-option[data-color="teal"] { background-color: var(--note-teal); }
.color-option[data-color="blue"] { background-color: var(--note-blue); }
.color-option[data-color="darkblue"] { background-color: var(--note-darkblue); }
.color-option[data-color="purple"] { background-color: var(--note-purple); }
.color-option[data-color="pink"] { background-color: var(--note-pink); }
.color-option[data-color="brown"] { background-color: var(--note-brown); }
.color-option[data-color="gray"] { background-color: var(--note-gray); }

/* Collaborator Modal */
.collaborator-modal-content {
  position: relative;
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 300px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.collaborator-modal-content h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
}

.add-collaborator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.add-collaborator input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Checklist */
.checklist {
  padding: 8px 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checklist-item input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 4px;
  font-family: inherit;
}

.checklist-item.checked input[type="text"] {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.checklist-item .delete-item {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.checklist-item:hover .delete-item {
  opacity: 1;
}

.add-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--text-secondary);
  cursor: pointer;
}

.add-checklist-item .material-icons {
  font-size: 18px;
}

/* Collaborators */
#collaborators-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

#collaborators-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

#collaborators-list .collaborator-info {
  display: flex;
  flex-direction: column;
}

#collaborators-list .collaborator-name {
  font-weight: 500;
}

#collaborators-list .collaborator-email {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Drawing Modal */
.drawing-modal-content {
  position: relative;
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.drawing-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.drawing-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.drawing-toolbar .icon-btn.active {
  background: var(--primary-color);
  color: var(--text-primary);
}

.drawing-toolbar .icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.drawing-toolbar .quick-colors {
  display: flex;
  gap: 4px;
}

.drawing-toolbar .color-btn {
  width: 24px;
  height: 24px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.drawing-toolbar .color-btn:hover {
  transform: scale(1.15);
}

.drawing-toolbar .color-btn.active {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

.drawing-toolbar input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.drawing-toolbar .size-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawing-toolbar .size-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.drawing-toolbar #size-value {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: center;
}

.drawing-toolbar input[type="range"] {
  width: 80px;
  accent-color: var(--primary-color);
}

/* Background color picker */
.bg-color-picker {
  position: relative;
}

.bg-color-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  width: 140px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.bg-color-dropdown.hidden {
  display: none;
}

.bg-color-option {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.bg-color-option:hover {
  transform: scale(1.1);
  border-color: var(--primary-color);
}

/* Text input dialog */
.text-input-dialog {
  position: absolute;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 1000;
  min-width: 200px;
}

.drawing-modal-content {
  position: relative;
}

.text-input-dialog.hidden {
  display: none;
}

.text-input-dialog input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 10px;
}

.text-input-dialog input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.text-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.text-dialog-buttons button {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: none;
}

.text-dialog-buttons .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.text-dialog-buttons .btn-secondary:hover {
  background: var(--hover-color);
}

.text-dialog-buttons .btn-primary {
  background: var(--primary-color);
  color: white;
}

.text-dialog-buttons .btn-primary:hover {
  opacity: 0.9;
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
}

#drawing-canvas {
  display: block;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: crosshair;
  background: #fff;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #323232;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 500;
  box-shadow: var(--shadow);
}

.toast .btn-text {
  color: var(--primary-color);
}

/* Share Modal */
.share-modal-content {
  position: relative;
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.share-modal-content h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 20px;
}

.share-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.share-link-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.share-link-section input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  background: var(--bg-secondary);
}

.share-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Empty State Logo */
.empty-state .logo-text {
  font-size: 72px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 16px;
  opacity: 0.3;
}

/* Public Note Screen */
.public-header {
  justify-content: space-between;
}

.public-content {
  padding: 100px 24px 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.public-note-card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.public-note-card h1 {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 16px;
}

#public-note-body {
  font-size: 16px;
  line-height: 1.6;
  /* white-space: pre-wrap; */
}

#public-note-body .checklist-preview {
  list-style: none;
  padding: 0;
}

#public-note-body .checklist-preview li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 16px;
}

#public-note-body .checklist-preview li.checked {
  text-decoration: line-through;
  color: var(--text-secondary);
}

#public-note-body .public-note-text {
  margin-bottom: 16px;
  white-space: pre-wrap;
}

#public-note-body .public-note-table {
  margin-top: 16px;
  overflow-x: auto;
}

#public-note-body .public-note-table table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
}

#public-note-body .public-note-table td {
  padding: 6px;
  border: 1px solid var(--border-color);
  min-width: 80px;
}

#public-note-images {
  margin: -24px -24px 16px;
}

#public-note-images img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

/* Table Styles */
.table-editor {
  width: 100%;
}

.table-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.note-table, .table-preview {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.note-table-preview .table-preview {
  font-size: 4px;
}

.public-note-table .table-preview {
  font-size: 14px;
}

.note-table td, .table-preview td {
  border: 1px solid var(--border-color);
  padding: 0 4px;
  min-width: 15px;
}

.note-table td[contenteditable] {
  outline: none;
  background: var(--bg-color);
}

.note-table td[contenteditable]:focus {
  background: var(--bg-secondary);
  box-shadow: inset 0 0 0 2px var(--primary-color);
}

.note-table .table-header {
  background: var(--bg-secondary);
}

.note-table .table-header th {
  padding: 4px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.row-number-cell {
  background: var(--bg-secondary) !important;
  color: var(--text-secondary) !important;
  font-weight: 500;
  text-align: center;
  min-width: 30px;
  padding: 8px 4px !important;
  border-right: 2px solid var(--border-color) !important;
  font-size: 12px;
}

.table-toolbar .toggle-row-numbers.active {
  background-color: var(--primary-color);
  color: var(--text-primary);
}

.delete-cell {
  width: 40px;
  text-align: center;
  background: var(--bg-secondary);
}

.delete-row, .delete-col {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
}

.delete-row:hover, .delete-col:hover {
  background: rgba(0,0,0,0.1);
  color: #d32f2f;
}

.note-table-preview {
  margin: 8px 0;
}

.table-preview {
  font-size: 12px;
  background: var(--bg-secondary);
}

.table-preview td {
  padding: 4px 6px;
  border: 1px solid var(--border-color);
}

.table-editor-modal {
  padding: 16px;
}

.table-container-input,
.table-container-modal {
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.table-container-input .table-editor,
.table-container-modal .table-editor {
  margin-top: 0;
}

/* Table Modal */
.table-modal-content {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 24px;
  max-width: 800px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

/* Modal Image Styles */
.modal-image {
  position: relative;
  display: inline-block;
  margin: 8px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-image img {
  display: block;
  max-width: 200px;
  max-height: 200px;
  object-fit: cover;
}

.delete-image-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(220, 53, 69, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 1;
  transition: background-color 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.delete-image-btn:hover {
  background: rgba(220, 53, 69, 1);
}

/* Active mode buttons */
.icon-btn.active {
  background-color: var(--primary-color);
  color: white;
}

.icon-btn.active:hover {
  background-color: #e67e04;
}

.public-note-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Public Note Colors */
.public-note-card[data-color="red"] { background-color: var(--note-red); }
.public-note-card[data-color="orange"] { background-color: var(--note-orange); }
.public-note-card[data-color="yellow"] { background-color: var(--note-yellow); }
.public-note-card[data-color="green"] { background-color: var(--note-green); }
.public-note-card[data-color="teal"] { background-color: var(--note-teal); }
.public-note-card[data-color="blue"] { background-color: var(--note-blue); }
.public-note-card[data-color="darkblue"] { background-color: var(--note-darkblue); }
.public-note-card[data-color="purple"] { background-color: var(--note-purple); }
.public-note-card[data-color="pink"] { background-color: var(--note-pink); }
.public-note-card[data-color="brown"] { background-color: var(--note-brown); }
.public-note-card[data-color="gray"] { background-color: var(--note-gray); }

/* Note public indicator */
.note-card .public-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  opacity: 0.7;
}

.note-card .public-badge .material-icons {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .nav-text {
    display: none;
  }

  .content {
    margin-left: var(--sidebar-collapsed);
  }

  .search-bar {
    display: none;
  }

  .header-left {
    min-width: auto;
  }

  .note-input-container {
    padding: 0 16px;
  }

  .notes-grid {
    grid-template-columns: 1fr;
  }
}

/* Cell Color Button (appears on hover) */
.table-cell {
  position: relative;
}

.cell-text {
  display: block;
  min-height: 1.2em;
  outline: none;
  padding-right: 48px;
}

.cell-link-btn,
.cell-color-btn,
.cell-bold-btn {
  position: absolute;
  top: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.cell-bold-btn {
  right: 50px;
}

.cell-link-btn {
  right: 26px;
}

.cell-color-btn {
  right: 2px;
}

.cell-color-btn .material-icons,
.cell-link-btn .material-icons,
.cell-bold-btn .material-icons {
  font-size: 14px;
  color: white;
}

.table-cell:hover .cell-color-btn,
.table-cell:hover .cell-link-btn,
.table-cell:hover .cell-bold-btn {
  opacity: 1;
}

.cell-color-btn:hover {
  background: rgba(255, 152, 0, 0.8);
}

.cell-link-btn:hover {
  background: rgba(33, 150, 243, 0.8);
}

.cell-bold-btn:hover {
  background: rgba(100, 100, 100, 0.8);
}

/* Link Dialog */
.link-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.link-dialog-content {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  min-width: 320px;
  max-width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.link-dialog-content h4 {
  margin: 0 0 12px 0;
  color: var(--text-primary);
  font-size: 18px;
}

.link-selected-text {
  color: var(--text-secondary);
  font-style: italic;
  margin: 0 0 16px 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  word-break: break-word;
}

.link-dialog-content input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.link-dialog-content input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.link-dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.link-dialog-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

#link-cancel-btn {
  background: transparent;
  color: var(--text-secondary);
}

#link-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#link-add-btn {
  background: var(--primary-color);
  color: white;
}

#link-add-btn:hover {
  background: #e67e04;
}

.link-label {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 4px;
}

.link-dialog-content input + .link-label {
  margin-top: 12px;
}

.link-remove-btn {
  background: #d32f2f !important;
  color: white !important;
  margin-right: auto;
}

.link-remove-btn:hover {
  background: #b71c1c !important;
}

/* Links in table cells */
.cell-text a {
  color: #2196f3;
  text-decoration: underline;
}

.cell-text a:hover {
  color: #64b5f6;
}

/* Cell Color Picker */
.cell-color-picker {
  position: fixed;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  max-width: 180px;
}

.cell-color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.cell-color-option:hover {
  transform: scale(1.15);
  border-color: var(--text-primary);
}

.cell-color-option[data-color="default"] { background: var(--card-bg); border: 2px dashed var(--border-color); }
.cell-color-option[data-color="red"] { background: #ef5350; }
.cell-color-option[data-color="orange"] { background: #ff9800; }
.cell-color-option[data-color="yellow"] { background: #ffeb3b; }
.cell-color-option[data-color="green"] { background: #66bb6a; }
.cell-color-option[data-color="teal"] { background: #26a69a; }
.cell-color-option[data-color="blue"] { background: #42a5f5; }
.cell-color-option[data-color="purple"] { background: #ab47bc; }
.cell-color-option[data-color="pink"] { background: #ec407a; }

/* Cell colors in table */
.note-table td[data-cell-color="red"] { background: #ef5350 !important; color: #fff !important; }
.note-table td[data-cell-color="orange"] { background: #ff9800 !important; color: #000 !important; }
.note-table td[data-cell-color="yellow"] { background: #ffeb3b !important; color: #000 !important; }
.note-table td[data-cell-color="green"] { background: #66bb6a !important; color: #000 !important; }
.note-table td[data-cell-color="teal"] { background: #26a69a !important; color: #fff !important; }
.note-table td[data-cell-color="blue"] { background: #42a5f5 !important; color: #000 !important; }
.note-table td[data-cell-color="purple"] { background: #ab47bc !important; color: #fff !important; }
.note-table td[data-cell-color="pink"] { background: #ec407a !important; color: #fff !important; }

/* Table preview colors */
.table-preview td[data-cell-color="red"] { background: #ef5350 !important; color: #fff !important; }
.table-preview td[data-cell-color="orange"] { background: #ff9800 !important; color: #000 !important; }
.table-preview td[data-cell-color="yellow"] { background: #ffeb3b !important; color: #000 !important; }
.table-preview td[data-cell-color="green"] { background: #66bb6a !important; color: #000 !important; }
.table-preview td[data-cell-color="teal"] { background: #26a69a !important; color: #fff !important; }
.table-preview td[data-cell-color="blue"] { background: #42a5f5 !important; color: #000 !important; }
.table-preview td[data-cell-color="purple"] { background: #ab47bc !important; color: #fff !important; }
.table-preview td[data-cell-color="pink"] { background: #ec407a !important; color: #fff !important; }

@media (max-width: 480px) {
  .sidebar {
    display: none;
  }

  .content {
    margin-left: 0;
  }

  .header-left .logo-text {
    display: none;
  }
}
