/* ==========================================================================
   VRADIAL IDEA VAULT - DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg-dark: #07130e;
  --bg-deep: #050d0a;
  --bg-panel: rgba(13, 31, 23, 0.75);
  --bg-card: rgba(18, 44, 33, 0.6);
  --bg-card-hover: rgba(22, 54, 40, 0.9);

  --emerald-primary: #10b981;
  --emerald-light: #34d399;
  --emerald-glow: rgba(16, 185, 129, 0.3);

  --flora-purple: #a855f7;
  --flora-pink: #ec4899;
  --solar-amber: #f59e0b;

  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;

  --border-glass: rgba(52, 211, 153, 0.2);
  --border-glass-bright: rgba(52, 211, 153, 0.45);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --transition-fast: all 0.25s ease;
}

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

body {
  background: radial-gradient(circle at 50% 0%, #0c241b 0%, var(--bg-deep) 80%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.6;
}

/* Glass Panels */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   LOCK SCREEN OVERLAY
   ========================================================================== */
.lock-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 13, 10, 0.85);
  backdrop-filter: blur(24px);
  z-index: 1000;
}

.lock-card {
  width: 100%;
  max-width: 440px;
  padding: 3rem 2.5rem;
  text-align: center;
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7),
              0 0 40px rgba(16, 185, 129, 0.2);
}

.lock-icon-wrap {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
}

.lock-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  background: linear-gradient(135deg, #fff, #a7f3d0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lock-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.lock-form .input-wrap {
  margin-bottom: 1rem;
}

.lock-form input[type="password"] {
  width: 100%;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.1em;
  transition: var(--transition-fast);
}

.lock-form input[type="password"]:focus {
  outline: none;
  border-color: var(--emerald-light);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.error-msg {
  color: #f87171;
  font-size: 0.85rem;
  min-height: 1.2rem;
  margin-bottom: 1rem;
}

.btn-unlock {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.btn-unlock:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6);
  transform: translateY(-2px);
}

.lock-footer {
  margin-top: 2rem;
}

.link-back {
  color: var(--emerald-light);
  text-decoration: none;
  font-size: 0.88rem;
  transition: var(--transition-fast);
}

.link-back:hover {
  color: #ffffff;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.8rem;
  margin-bottom: 2rem;
  border-radius: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
}

.logo-leaf {
  font-size: 1.4rem;
}

.vault-tag {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-search {
  flex: 1;
  max-width: 480px;
}

.search-box {
  position: relative;
  width: 100%;
}

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

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 0.92rem;
  transition: var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--emerald-light);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  transform: translateY(-2px);
}

.btn-ai-pulse {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(236, 72, 153, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #f3e8ff;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

.btn-ai-pulse:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(236, 72, 153, 0.4));
  border-color: #d8b4fe;
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.4);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

.btn-icon:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
}

/* ==========================================================================
   TAG FILTERS
   ========================================================================== */
.tag-filter-bar {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.tag-pill {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-sub);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.tag-pill:hover,
.tag-pill.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--mint-accent);
}

/* ==========================================================================
   NOTE EDITOR CARD
   ========================================================================== */
.note-editor-card {
  padding: 2rem;
  margin-bottom: 2.5rem;
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5),
              0 0 25px rgba(16, 185, 129, 0.15);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.editor-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem;
}

.btn-close:hover {
  color: #ffffff;
}

.editor-form .form-group {
  margin-bottom: 1.2rem;
}

.editor-form input[type="text"],
.editor-form textarea {
  width: 100%;
  padding: 0.85rem 1.2rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.editor-form textarea {
  resize: vertical;
  line-height: 1.6;
}

.editor-form input[type="text"]:focus,
.editor-form textarea:focus {
  outline: none;
  border-color: var(--emerald-light);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.form-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.flex-1 {
  flex: 1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: var(--text-sub);
}

.checkbox-label input {
  display: none;
}

.custom-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.checkbox-label input:checked + .custom-check {
  background: var(--emerald-primary);
  border-color: var(--emerald-light);
}

.checkbox-label input:checked + .custom-check::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.btn-save {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

/* ==========================================================================
   NOTES GRID & CARDS
   ========================================================================== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.note-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition-fast);
}

.note-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-bright);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5),
              0 0 20px rgba(16, 185, 129, 0.2);
  transform: translateY(-3px);
}

.note-card.pinned {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(28, 48, 36, 0.75);
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.note-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.pin-star {
  color: var(--solar-amber);
  font-size: 1.1rem;
}

.note-body {
  color: var(--text-sub);
  font-size: 0.93rem;
  line-height: 1.65;
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
  flex-grow: 1;
}

.note-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.note-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--mint-accent);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.8rem;
}

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

.note-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.action-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.action-btn.delete:hover {
  color: #f87171;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   AI INTEGRATION MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 13, 10, 0.8);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  padding: 2.5rem;
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7),
              0 0 30px rgba(168, 85, 247, 0.25);
}

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

.modal-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  font-weight: 600;
  font-size: 0.85rem;
}

.modal-heading {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.modal-intro {
  color: var(--text-sub);
  font-size: 0.92rem;
  margin-bottom: 1.8rem;
  line-height: 1.6;
}

.endpoint-item {
  margin-bottom: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 1.2rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}

.method.get {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.endpoint-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.endpoint-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.code-box code {
  font-family: monospace;
  font-size: 0.85rem;
  color: #a7f3d0;
  word-break: break-all;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.8rem;
  white-space: nowrap;
}

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

.api-token-info {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
}

.token-val {
  font-family: monospace;
  font-weight: 700;
  color: #e9d5ff;
}

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

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions {
    justify-content: space-between;
  }
  .notes-grid {
    grid-template-columns: 1fr;
  }
}
/* 1. Modal Scrollbar Fix */
.modal-body {
  overflow-y: auto;
  max-height: 65vh;
  padding-right: 10px;
}
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.4);
  border-radius: 4px;
}

/* 2. Category Select */
.note-category {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(52, 211, 153, 0.15);
  color: var(--emerald-light);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 6px;
  border: 1px solid rgba(52, 211, 153, 0.3);
}
select#note-category {
  width: 100%;
  padding: 0.8rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: inherit;
  margin-bottom: 1rem;
}
select#note-category option {
  background: var(--bg-dark);
}

/* 3. Rich Editor */
.rich-editor {
  width: 100%;
  min-height: 150px;
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.6;
}
.rich-editor:focus {
  outline: none;
  border-color: var(--emerald-light);
  background: rgba(0, 0, 0, 0.4);
}
.rich-editor img {
  max-width: 100%;
  border-radius: 8px;
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.rich-editor[empty]:before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block; /* For Firefox */
}
.note-body img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 10px;
}

/* 4. Synced Icon */
.sync-icon {
  margin-left: 8px;
  color: #3b82f6;
  font-size: 1rem;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sync-icon svg {
  width: 16px;
  height: 16px;
}
/* Specific Category Styles */
.note-category.cat-second_brain {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.4);
}
.note-category.cat-llm_action {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}
.note-category.cat-design {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.4);
}
