@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* NoteLab.cloud - Interface Hyper Notepad Ultra-Fidèle */

:root {
  --bg-app: #121316;
  --bg-sidebar: #17181c;
  --bg-editor: #0a0a0a;
  --border-color: #24262e;
  --border-subtle: #1e2026;

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --hover-bg: rgba(255, 255, 255, 0.05);
  --active-bg: rgba(255, 255, 255, 0.08);

  --accent: #3b82f6;
  --btn-save-bg: #ffffff;
  --btn-save-text: #0f1117;
}

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

body,
input,
textarea,
select,
button {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

.app-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* -------------------------------------------------------------
   1. SIDEBAR GAUCHE
   ------------------------------------------------------------- */
.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s ease, transform 0.25s ease;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  transform: translateX(-100%);
  border-right: none;
}

.sidebar-header {
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo-icon {
  display: flex;
  gap: 3px;
  align-items: center;
}

.brand-logo-icon span {
  width: 4px;
  height: 16px;
  border-radius: 2px;
}

.brand-logo-icon span:nth-child(1) {
  background: #f97316;
  height: 12px;
}

.brand-logo-icon span:nth-child(2) {
  background: #3b82f6;
  height: 16px;
}

.brand-logo-icon span:nth-child(3) {
  background: #a855f7;
  height: 14px;
}

.brand-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.btn-icon-header {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.btn-icon-header:hover {
  background: var(--hover-bg);
  color: #fff;
}

/* Search bar */
.sidebar-search {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: #1c1d22;
  padding: 15px;
  gap: 0.5rem;
  transition: border-color 0.2s;
}

.search-input-wrapper:focus-within {
  border-color: #3b82f6;
}

.search-input-wrapper svg {
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.search-input-wrapper input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.84rem;
  width: 100%;
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.btn-filter-sort {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 12px;
}

.btn-filter-sort:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

/* Notes List */
.sidebar-notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 15px 0px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-notes-list::-webkit-scrollbar {
  width: 5px;
}

.sidebar-notes-list::-webkit-scrollbar-thumb {
  background: #252730;
  border-radius: 4px;
}

.note-item {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background 0.15s;
}

.note-item:hover {
  background: var(--hover-bg);
}

.note-item.active {
  background: var(--active-bg);
}

.note-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.btn-note-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  padding: 2px 4px;
  border-radius: 4px;
}

.note-item:hover .btn-note-delete {
  opacity: 1;
}

.btn-note-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.notes-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-signin {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  border-right: 1px solid var(--border-color);
  padding: 15px;
  background: #22c55e;
  color: #000;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-signin:hover {
  background: #fff;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 11px;
  overflow: hidden;
}

.user-badge img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.user-badge-name {
  font-size: 0.84rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 105px;
}

.btn-signout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 2px;
}

.btn-signout:hover {
  color: #ef4444;
}

.footer-actions {
  display: flex;
  align-items: center;
}

.footer-icon-btn {
  background: none;
  border: none;
  background: #1c1d22;
  color: #fff;
  border-left: 1px solid var(--border-color);
  cursor: pointer;
  padding: 14px;
  margin: -1px;
  /* border-radius: 5px; */
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-icon-btn:hover {
  color: #fff;
  background: var(--hover-bg);
}

/* -------------------------------------------------------------
   2. MAIN EDITOR PANEL
   ------------------------------------------------------------- */
.main-editor-pane {
  flex: 1;
  background-color: var(--bg-editor);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* Top Toolbar */
.editor-top-bar {
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-editor);
  z-index: 5;
}

.toolbar-group {
  display: flex;
  align-items: center;
}

.toolbar-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  width: 37px;
  height: 37px;
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.toolbar-btn:hover {
  background: var(--hover-bg);
  color: #fff;
}

.toolbar-btn.active {
  background: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
}

.toolbar-btn svg {
  stroke: currentColor;
  flex-shrink: 0;
  transition: stroke 0.15s;
}

.toolbar-separator {
  width: 1px;
  height: 18px;
  background-color: var(--border-color);
  margin: 0 0.35rem;
  flex-shrink: 0;
}

/* =============================================================
   CUSTOM DROPDOWN (FORMAT & FONT FAMILY)
   ============================================================= */
.custom-dropdown-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.custom-dropdown-trigger {
  background: transparent;
  border: none;
  color: #d1d5db;
  border-right: 1px solid var(--border-color);
  font-size: 0.9em;
  font-weight: 500;
  font-family: inherit;
  padding: 10px;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.18s ease;
  user-select: none;
  white-space: nowrap;
}

.custom-dropdown-trigger:hover,
.custom-dropdown-container.open .custom-dropdown-trigger {
  background: var(--hover-bg);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
}

.custom-dropdown-trigger .trigger-icon {
  color: #9ca3af;
  flex-shrink: 0;
}

.custom-dropdown-trigger:hover .trigger-icon,
.custom-dropdown-container.open .custom-dropdown-trigger .trigger-icon {
  color: #60a5fa;
}

.dropdown-chevron {
  color: #9ca3af;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.custom-dropdown-container.open .dropdown-chevron {
  transform: rotate(180deg);
  color: #60a5fa;
}

/* Menu déroulant flottant */
.custom-dropdown-menu {
  position: absolute;
  top: 100%;
  left: -1px;
  min-width: 240px;
  background: #17181c;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(14px);
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-dropdown-container.open .custom-dropdown-menu {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dropdown-header-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #6b7280;
  padding: 0.4rem 0.6rem 0.25rem;
  user-select: none;
}

.dropdown-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 0.3rem 0;
}

/* Éléments du menu */
.custom-dropdown-item {
  background: transparent;
  border: none;
  padding: 0.45rem 0.65rem;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  position: relative;
}

.custom-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.custom-dropdown-item.active {
  background: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
}

.custom-dropdown-item .item-badge {
  width: 26px;
  height: 26px;
  min-width: 26px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.custom-dropdown-item:hover .item-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
}

.custom-dropdown-item.active .item-badge {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.custom-dropdown-item .item-badge svg {
  stroke: currentColor;
  display: block;
}

.custom-dropdown-item .item-font-preview {
  width: 26px;
  height: 26px;
  min-width: 26px;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.custom-dropdown-item:hover .item-font-preview {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
}

.custom-dropdown-item.active .item-font-preview {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.custom-dropdown-item.active .item-font-preview {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.custom-dropdown-item .item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.custom-dropdown-item .item-title {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
}

.custom-dropdown-item .item-desc {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.1;
}

.custom-dropdown-item .item-check {
  margin-left: auto;
  color: #3b82f6;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.custom-dropdown-item.active .item-check {
  opacity: 1;
  transform: scale(1);
}

/* Polices appliquées à l'éditeur */
.note-content-editor[data-font="inter"] {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.note-content-editor[data-font="merriweather"] {
  font-family: 'Merriweather', Georgia, serif !important;
}

.note-content-editor[data-font="jetbrains-mono"] {
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace !important;
}

.note-content-editor[data-font="outfit"] {
  font-family: 'Outfit', 'Inter', sans-serif !important;
}

.note-content-editor[data-font="playfair"] {
  font-family: 'Playfair Display', Georgia, serif !important;
}

/* Bouton Save */
.btn-save-cloud {
  background: var(--btn-save-bg);
  color: var(--btn-save-text);
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s, background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-save-cloud:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

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

.btn-save-cloud.saved {
  background: #22c55e;
  color: #fff;
}

/* Writing Area */
.editor-workspace {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 30px;
  width: 100%;
  margin: 0 auto;
}

.note-title-input {
  background: none;
  border: none;
  outline: none;
  font-size: 1.85rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.25rem;
  font-family: inherit;
  width: 100%;
}

.note-title-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.note-content-editor {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #d1d5db;
  min-height: 500px;
  user-select: text;
  tab-size: 4;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-content-editor:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.note-content-editor ul {
  list-style-type: disc;
  padding-left: 2rem;
  margin: 0.6rem 0;
}

.note-content-editor ol {
  list-style-type: decimal;
  padding-left: 2rem;
  margin: 0.6rem 0;
}

.note-content-editor li {
  margin: 0.3rem 0;
  display: list-item;
}

.note-content-editor blockquote {
  border-left: 3px solid #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  padding: 0.6rem 1.1rem;
  margin: 0.8rem 0;
  color: #9ca3af;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.note-content-editor pre {
  background: #17181c;
  border: 1px solid #24262e;
  border-radius: 0px;
  padding: 0.85rem 1.1rem;
  font-size: 1rem;
  color: #38bdf8;
  overflow-x: auto;
  margin: 0.8rem 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.note-content-editor h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: #ffffff;
  margin: 1.2rem 0 0.5rem;
  line-height: 1.25;
}

.note-content-editor h2 {
  font-size: 1.45rem;
  font-weight: 600;
  color: #f3f4f6;
  margin: 1rem 0 0.4rem;
  line-height: 1.3;
}

.note-content-editor h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0.8rem 0 0.35rem;
  line-height: 1.35;
}

.note-content-editor p {
  margin: 0.4rem 0;
  min-height: 1.5em;
}

.note-content-editor a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s;
}

.note-content-editor a:hover {
  color: #93c5fd;
}

/* -------------------------------------------------------------
   3. MODAL DE CONNEXION GOOGLE (POPUP)
   ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-dialog {
  background: #17181d;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2.2rem 2rem;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  position: relative;
}

.btn-close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-close-modal:hover {
  color: #fff;
}

.modal-logo {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 1.25rem;
}

.modal-logo span {
  width: 5px;
  height: 20px;
  border-radius: 2px;
}

.modal-logo span:nth-child(1) {
  background: #f97316;
  height: 16px;
}

.modal-logo span:nth-child(2) {
  background: #3b82f6;
  height: 22px;
}

.modal-logo span:nth-child(3) {
  background: #a855f7;
  height: 18px;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
}

.modal-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1.8rem;
}

.google-btn-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  margin-bottom: 1.5rem;
}

.modal-footer-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}