/* =========================================
   FLOATING TOGGLE
========================================= */
.notes-floating-toggle {
  position: fixed;
  left: 0;
  top: 33%;
  transform: translateY(-50%);
  width: 32px;
  height: auto;
  padding: 14px 0;
  border: none;
  border-radius: 0 14px 14px 0;
  background: var(--clr-white);
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 1001;
  cursor: pointer;
  transition:
    width 0.2s ease,
    box-shadow 0.2s ease;
}
.notes-floating-toggle:hover {
  width: 36px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
}
.notes-floating-toggle i {
  font-size: 16px;
  background: linear-gradient(135deg, #7c6fcd, #c86dd7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex-shrink: 0;
}
.notes-toggle-text {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: "Vazirmatn", sans-serif;
  color: var(--clr-muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  letter-spacing: 0.4px;
  transition: color 0.2s;
  line-height: 1;
}
.notes-floating-toggle:hover .notes-toggle-text {
  color: #7c6fcd;
}
[data-theme="dark"] .notes-floating-toggle {
  background: #1a1d2e;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
@media (max-width: 768px) {
  .notes-floating-toggle {
    width: 24px;
    padding: 12px 0;
  }
  .notes-floating-toggle i {
    font-size: 14px;
  }
  .notes-toggle-text {
    display: none;
  }
}

/* =========================================
   SIDEBAR
========================================= */
.notes-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 380px;
  max-width: 100%; /* full width on small phones */
  height: 100vh;
  background: var(--clr-white);
  border-right: 1px solid var(--clr-border);
  z-index: 1002;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.16);
}
.notes-sidebar.open {
  transform: translateX(0);
}

@media (max-width: 480px) {
  .notes-sidebar {
    width: 85%;
    border-right: none;
  }
}

.notes-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 1001;
}
.notes-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.notes-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  direction: rtl;
}
.notes-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.notes-title i {
  font-size: 20px;
  background: linear-gradient(135deg, #7c6fcd, #c86dd7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.notes-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg);
  color: var(--clr-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  transition:
    background 0.18s,
    color 0.18s,
    border-color 0.18s;
  flex-shrink: 0;
}
.notes-close:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* Body */
.notes-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

/* Form */
.notes-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.notes-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Title input */
.notes-title-input {
  width: 100%;
  border-radius: 12px;
  border: 1.5px solid var(--clr-border);
  background: var(--clr-bg);
  color: var(--clr-text);
  padding: 10px 13px;
  font-family: "Vazirmatn", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  direction: rtl;
  text-align: right;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
}
.notes-title-input::placeholder {
  color: var(--clr-muted);
  direction: rtl;
  text-align: right;
  font-weight: 400;
}
.notes-title-input:focus {
  outline: none;
  border-color: #7c6fcd;
  box-shadow: 0 0 0 4px rgba(124, 111, 205, 0.12);
}

/* Textarea */
.notes-textarea {
  width: 100%;
  min-height: 100px;
  resize: none;
  border-radius: 12px;
  border: 1.5px solid var(--clr-border);
  background: var(--clr-bg);
  color: var(--clr-text);
  padding: 12px 13px;
  font-family: "Vazirmatn", sans-serif;
  font-size: 0.875rem;
  line-height: 1.65;
  direction: rtl;
  text-align: right;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
}
.notes-textarea::placeholder {
  color: var(--clr-muted);
  direction: rtl;
  text-align: right;
}
.notes-textarea:focus {
  outline: none;
  border-color: #7c6fcd;
  box-shadow: 0 0 0 4px rgba(124, 111, 205, 0.12);
}

.notes-submit {
  direction: rtl;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #7c6fcd, #c86dd7);
  color: white;
  font-family: "Vazirmatn", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition:
    opacity 0.18s,
    transform 0.14s;
  touch-action: manipulation;
}
.notes-submit:hover {
  opacity: 0.9;
}
.notes-submit:active {
  transform: scale(0.97);
}
.notes-submit i {
  font-size: 17px;
}

/* List */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-notes {
  text-align: center;
  padding: 44px 10px;
  color: var(--clr-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  direction: rtl;
}
.empty-notes i {
  font-size: 38px;
  opacity: 0.3;
}

/* Note card */
.note-item {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 13px 14px;
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    background 0.18s;
  direction: rtl;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.note-item:hover {
  border-color: rgba(124, 111, 205, 0.4);
  box-shadow: 0 2px 12px rgba(124, 111, 205, 0.1);
}
.note-item:active {
  transform: scale(0.99);
}
.note-item.copied {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.06) !important;
}

/* Copied badge */
.note-copy-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #22c55e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  font-family: "Vazirmatn", sans-serif;
}
.note-item.copied .note-copy-badge {
  opacity: 1;
  transform: translateY(0);
}

.note-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #7c6fcd;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: 5px;
}
.note-title i {
  font-size: 14px;
}

[data-theme="dark"] .note-title {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* Note text */
.note-content {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--clr-text);
  word-break: break-word;
}

/* Actions row — delete left, copy right */
.note-actions {
  margin-top: 11px;
  display: flex;
  justify-content: space-between; /* delete on left, copy on right */
  align-items: center;
  direction: ltr; /* keeps delete physical-left, copy physical-right */
}

.note-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.77rem;
  font-weight: 600;
  font-family: "Vazirmatn", sans-serif;
  transition:
    opacity 0.15s,
    transform 0.12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.note-btn:active {
  transform: scale(0.95);
}
.note-btn i {
  font-size: 15px;
}

.note-btn.copy {
  background: rgba(124, 111, 205, 0.13);
  color: #7c6fcd;
}
.note-btn.copy:hover {
  background: rgba(124, 111, 205, 0.22);
}

.note-btn.delete {
  background: rgba(239, 68, 68, 0.11);
  color: #ef4444;
}
.note-btn.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}
.notes-toggle-label {
  position: fixed;
  left: 40px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--clr-muted);
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
  transition: color 0.2s;
  font-family: "Vazirmatn", sans-serif;
}

.notes-floating-toggle:hover ~ .notes-toggle-label,
.notes-toggle-label:hover {
  color: #7c6fcd;
}

/* hide on mobile — no room */
@media (max-width: 768px) {
  .notes-toggle-label {
    display: none;
  }
}
.note-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px 2px 6px;
  border-radius: 6px;
  background: rgba(124, 111, 205, 0.12);
  color: #7c6fcd;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: "Vazirmatn", sans-serif;
  text-decoration: none;
  word-break: break-all;
  transition:
    background 0.15s,
    color 0.15s;
  vertical-align: middle;
}
.note-link:hover {
  background: rgba(124, 111, 205, 0.22);
  color: #5b4fa8;
}
.note-link i {
  font-size: 13px;
  flex-shrink: 0;
}
.note-link span {
  display: inline-block;
  text-align: left;
}
[data-theme="dark"] .note-link {
  background: rgba(124, 111, 205, 0.2);
  color: #a99ef0;
}
[data-theme="dark"] .note-link:hover {
  background: rgba(124, 111, 205, 0.32);
  color: #c4bcf7;
}
