:root {
  /* Color Palette - Premium Dark Theme */
  --bg-base: #0f172a;
  --bg-surface: rgba(30, 41, 59, 0.7);
  --bg-surface-hover: rgba(51, 65, 85, 0.8);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --accent: #ec4899;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);
  
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  /* Add a subtle background gradient mesh */
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%);
}

.hidden {
  display: none !important;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.glass-header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  height: 70px;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-brand .logo-icon {
  font-size: 2rem;
  color: var(--primary);
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.header-brand h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

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

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  z-index: 10;
  pointer-events: none;
}

.search-box input[type="text"] {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
  transition: var(--transition);
}

.search-box input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  width: 100%;
  background: rgba(0,0,0,0.4);
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

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

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.25rem;
}

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

.btn-primary-light {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-primary-light:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Main Layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 1.5rem;
  gap: 1.5rem;
}

/* Sidebar */
.sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.entries-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.entries-list::-webkit-scrollbar {
  width: 6px;
}
.entries-list::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: var(--radius-full);
}

.entry-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.entry-item:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--border-light);
}

.entry-item.active {
  background: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.3);
}

.entry-item.active .entry-title {
  color: var(--primary);
}

.entry-title {
  font-weight: 500;
  font-size: 0.95rem;
}

.entry-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Editor Area */
.editor-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.editor-area::-webkit-scrollbar {
  width: 8px;
}
.editor-area::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: var(--radius-full);
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.section-header h3 {
  font-size: 1.2rem;
  font-weight: 500;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"], textarea, select {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  background: rgba(0,0,0,0.4);
}

select option {
  background: #1e293b;
  color: var(--text-primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Markdown specific */
.markdown-group .split-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.markdown-preview {
  background: rgba(0,0,0,0.1);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-y: auto;
  max-height: 200px;
}

/* Markdown body styles matching Github/general styles roughly */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}
.markdown-body h1:first-child, .markdown-body h2:first-child { margin-top: 0; }
.markdown-body p { margin-bottom: 1rem; }
.markdown-body a { color: var(--primary); }

/* Meanings Section */
.meanings-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meaning-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  transition: var(--transition);
}

.meaning-card:hover {
  border-color: rgba(255,255,255,0.15);
}

.meaning-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.meaning-index {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Tooltips */
.custom-tooltip {
  position: fixed;
  background: #1e293b;
  color: #f8fafc;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  opacity: 0;
  transition: opacity 0.2s ease;
  transform: translate(-50%, 10px);
  max-width: 250px;
  text-align: center;
}

.custom-tooltip.visible {
  opacity: 1;
}

.tooltip-trigger {
  cursor: help;
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  width: 100%;
  max-width: 450px;
  padding: 2rem;
}

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

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-info h3 {
  font-size: 1rem;
  font-weight: 500;
}

.setting-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .4s;
  border-radius: 24px;
}

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

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

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

/* Drag & Drop Overlay */
#drop-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px dashed var(--primary);
  margin: 1rem;
  border-radius: var(--radius-lg);
}

.drop-content {
  text-align: center;
  color: var(--primary);
  pointer-events: none;
}

.drop-content i {
  font-size: 4rem;
  margin-bottom: 1rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  text-align: center;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}
