/* ===================================== 
   PRISMSLATEUI - MODERN GLASSMORPHISM DESIGN SYSTEM
   ===================================== */

:root {
  /* Core Blue Accent Colors - Primary Theme */
  --primary-blue: #3b82f6;        /* Vibrant Blue */
  --primary-blue-hover: #2563eb;  /* Deeper Blue */
  --secondary-blue: #60a5fa;      /* Light Blue */
  --accent-purple: #8b5cf6;       /* Purple Accent */
  
  /* Cool-Toned Gray Backgrounds with Blue Undertones */
  --neutral-50: #f8fafc;          /* Lightest Blue-Gray */
  --neutral-100: #f1f5f9;         /* Very Light Blue-Gray */
  --neutral-200: #e2e8f0;         /* Light Blue-Gray */
  --neutral-300: #cbd5e1;         /* Medium Light Blue-Gray */
  --neutral-400: #94a3b8;         /* Medium Blue-Gray */
  --neutral-500: #64748b;         /* Base Blue-Gray */
  --neutral-600: #475569;         /* Dark Blue-Gray */
  --neutral-700: #334155;         /* Darker Blue-Gray */
  --neutral-800: #1e293b;         /* Very Dark Blue-Gray */
  --neutral-900: #0f172a;         /* Darkest Blue-Gray */

  /* Status Colors with Blue Harmony */
  --success-color: #10b981;       /* Emerald Green */
  --danger-color: #ef4444;        /* Vibrant Red */
  --warning-color: #f59e0b;       /* Amber */
  --info-color: var(--primary-blue);

  /* Light Theme Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: var(--neutral-50);
  --bg-tertiary: var(--neutral-100);
  --bg-accent: var(--neutral-200);
  --bg-glass: rgba(248, 250, 252, 0.8);

  /* Light Theme Text */
  --text-primary: var(--neutral-800);
  --text-secondary: var(--neutral-600);
  --text-muted: var(--neutral-500);

  /* Borders & Shadows with Blue Undertones */
  --border-color: var(--neutral-200);
  --border-accent: var(--primary-blue);
  
  /* Enhanced Shadows for Depth */
  --shadow-sm: 0 1px 2px 0 rgba(59, 130, 246, 0.05);
  --shadow: 0 1px 3px 0 rgba(59, 130, 246, 0.1), 0 1px 2px 0 rgba(59, 130, 246, 0.06);
  --shadow-lg: 0 4px 6px -1px rgba(59, 130, 246, 0.1), 0 2px 4px -1px rgba(59, 130, 246, 0.06);
  --shadow-xl: 0 10px 15px -3px rgba(59, 130, 246, 0.1), 0 4px 6px -2px rgba(59, 130, 246, 0.05);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

  /* Modern Glassmorphism Effects */
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(59, 130, 246, 0.15);
  --backdrop-blur: blur(16px);

  /* Blue-to-Purple Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-purple) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-blue) 0%, var(--primary-blue) 100%);
  --gradient-accent: linear-gradient(135deg, var(--neutral-50) 0%, var(--neutral-100) 100%);
  --gradient-glass: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);

  /* UI Properties */
  --border-radius: 0.75rem;
  --border-radius-lg: 1rem;
  --border-radius-full: 9999px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Dark Theme Backgrounds with Blue Undertones */
  --bg-primary: var(--neutral-900);
  --bg-secondary: var(--neutral-800);
  --bg-tertiary: var(--neutral-700);
  --bg-accent: var(--neutral-600);
  --bg-glass: rgba(15, 23, 42, 0.8);

  /* Dark Theme Text */
  --text-primary: var(--neutral-50);
  --text-secondary: var(--neutral-300);
  --text-muted: var(--neutral-400);

  /* Dark Theme Borders */
  --border-color: var(--neutral-700);
  
  /* Enhanced Dark Mode Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.25);
  --glass-border: rgba(148, 163, 184, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

  /* Brighter Blue Accents for Dark Mode */
  --primary-blue: #60a5fa;
  --primary-blue-hover: #3b82f6;
  --secondary-blue: #93c5fd;
  --accent-purple: #a78bfa;
}

/* ========================================
   GLOBAL STYLES & FOUNDATION
   ======================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--gradient-primary);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
}

.container {
  max-width: 1450px;
  margin: 0 auto;
  padding: 0.5rem;
  background: var(--bg-primary);
  min-height: 100vh;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  backdrop-filter: var(--backdrop-blur);
}

/* ========================================
   HEADER WITH ENHANCED GLASSMORPHISM
   ======================================== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.0rem;
  background: var(--glass-bg);
  margin: -0.5rem -0.5rem 0.3rem -0.5rem;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 10;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0.1;
  z-index: -1;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding-right: 1.0rem;
}

.app-icon {
  font-size: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.entry-count {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-grow: 1;
}

.ellipsis-menu {
    position: relative;
    display: inline-block;
}

.menu-items {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-secondary);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
}

.menu-items .icon-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    border-radius: 0;
    gap: 0.75rem;
}

.menu-items .icon-btn:hover {
    background-color: var(--primary-blue);
}


/* ========================================
   MODERN BUTTON SYSTEM
   ======================================== */

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.1);
}

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

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--shadow);
}

.btn-secondary:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.icon-btn {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  padding: 0.75rem;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  box-shadow: var(--shadow);
}

.icon-btn:hover {
  background: var(--primary-blue);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.icon-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.icon-btn.starred {
  background: var(--secondary-blue);
  border-color: var(--secondary-blue);
  color: white;
}

/* ========================================
   ENHANCED FILTERS SECTION
   ======================================== */

.filters {
    display: flex;
    flex-grow: 1;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    background: transparent;
    border-radius: 0;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
}

#paginationContainer {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input,
.select-input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  /* min-width: 200px; */
  box-shadow: var(--shadow-sm);
}

.search-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow);
  transform: translateY(-1px);
}

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

.filter-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.page-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.875rem;
    min-width: 44px;
    height: 44px;
    border-radius: var(--border-radius-full);
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-fast);
    font-weight: 600;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}

.page-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-lg);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: var(--bg-accent);
}


/* ========================================
   GLASSMORPHISM FORM CONTAINER
   ======================================== */

.form-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

.form-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-glass);
  z-index: -1;
}

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

.form-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-header .icon-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow);
  transform: translateY(-1px);
}

/* ========================================
   ENHANCED RICH TEXT EDITOR
   ======================================== */

.rich-editor {
  min-height: 200px;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.6;
  overflow-y: auto;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.rich-editor[contenteditable]:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  font-style: italic;
}

/* Rich Text Content Styling */
.rich-editor h1, .rich-editor h2, .rich-editor h3, .rich-editor h4, .rich-editor h5, .rich-editor h6,
.answer-display h1, .answer-display h2, .answer-display h3, .answer-display h4, .answer-display h5, .answer-display h6 {
  font-weight: 700;
  margin: 1rem 0 0.5rem 0;
  color: var(--text-primary);
}

.rich-editor h1, .answer-display h1 { font-size: 1.5rem; }
.rich-editor h2, .answer-display h2 { font-size: 1.25rem; }
.rich-editor h3, .answer-display h3 { font-size: 1.125rem; }

.rich-editor p, .answer-display p {
  margin: 0.75rem 0;
  line-height: 1.6;
}

.rich-editor ul, .rich-editor ol, .answer-display ul, .answer-display ol {
  margin: 0.75rem 0;
  padding-left: 2rem;
}

.rich-editor li, .answer-display li {
  margin: 0.25rem 0;
  line-height: 1.5;
}

.rich-editor strong, .answer-display strong {
  font-weight: 700;
  color: var(--text-primary);
}

.rich-editor em, .answer-display em {
  font-style: italic;
}

.rich-editor u, .answer-display u {
  text-decoration: underline;
}

.rich-editor code, .answer-display code {
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  border: 1px solid var(--border-color);
}

.rich-editor blockquote, .answer-display blockquote {
  border-left: 4px solid var(--primary-blue);
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  font-style: italic;
}

/* ========================================
   ENHANCED TAGS SYSTEM
   ======================================== */

.tags-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-height: 50px;
  padding: 0.75rem;
  background: var(--glass-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--shadow-sm);
}

.tag {
  background: var(--gradient-primary);
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.tag .remove-tag {
  cursor: pointer;
  opacity: 0.8;
  transition: var(--transition);
  font-weight: bold;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.tag .remove-tag:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.3);
}

.duplicate-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--warning-color);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* ========================================
   GLASSMORPHISM MODAL SYSTEM
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(12px);
  padding: 1rem;
  overflow-y: auto; /* Add this to handle overflow */
}

.modal-content {
  background: var(--glass-bg);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  margin: auto; /* Add this for better centering */
    position: relative; /* Add this */
}

.modal-overlay {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

/* Ensure modal content is centered even with scroll */
.modal-content {
    position: relative !important;
    transform: none !important;
    margin: auto !important;
}


.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 500;
}

#settingsModal .modal-header .icon-btn {
  background: rgba(239, 68, 68, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#settingsModal .modal-header .icon-btn:hover {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

.modal-body {
  padding: 0.5rem;
}

.modal-body-settings {
  padding: 0.5rem;
  background-color: aliceblue;
}

/* When modal is open, prevent body scroll */
body.modal-open {
    overflow: hidden !important;
    position: relative !important;
}

.modal-question {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  padding: 1rem;
  background: var(--gradient-accent);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.modal-answer-section {
  background: var(--glass-bg);
  border-radius: var(--border-radius-lg);
  padding: 1rem;
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--glass-shadow);
}

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

.answer-header h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.answer-header .icon-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  width: auto;
  height: auto;
  padding: 0.75rem 1.5rem;
}

.answer-header .icon-btn:hover {
  background: var(--primary-blue-hover);
  transform: translateY(-1px);
}

.answer-display {
  background: var(--bg-primary);
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  line-height: 1.8;
  min-height: 200px;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

.answer-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ========================================
   MAIN CONTENT & ENTRY CARDS
   ======================================== */

.main-content {
  min-height: 400px;
  padding: 0.5rem;
}

.entries-container {
  transition: var(--transition);
}

.entries-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
    gap: 2rem;
}

.entries-container.list-view {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.entry-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.entry-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: var(--primary-blue);
}

.entry-card:nth-child(2n)::before {
  background: var(--gradient-secondary);
}

.entry-card:nth-child(3n)::before {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--primary-blue) 100%);
}

.entry-card:nth-child(4n)::before {
  background: linear-gradient(135deg, var(--warning-color) 0%, var(--accent-purple) 100%);
}

.entry-card.collapsed {
  padding: 1rem;
  min-height: auto;
}

.entry-card.visited {
  opacity: 0.4;
  background: var(--neutral-300);
}

.entry-card.collapsed .entry-content {
  display: none;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.entry-title-section {
  flex: 1;
}

.entry-card.collapsed .entry-header {
  margin-bottom: 0;
}

.entry-card:not(.collapsed) .entry-header {
  margin-bottom: 1.5rem;
}

.entry-title {
  flex: 1;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 550;
  color: var(--text-primary);
  transition: var(--transition);
  line-height: 1.4;
}

.entry-card.collapsed .entry-title {
  font-size: 1rem;
  line-height: 1.3;
}

.entry-title:hover {
  color: var(--primary-blue);
}

/* Actions trigger icon */
.entry-actions-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-full);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.entry-actions-trigger:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.entry-actions-trigger i {
  font-size: 0.875rem;
}

/* Hidden actions that appear on hover */
.entry-actions {
  position: absolute;
  top: 50%;
  right: 100%;
  margin-right: 0;
  transform: translateY(-50%) translateX(10px);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 0.5rem;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--glass-shadow);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 10;
  white-space: nowrap;
}

/* Expand hover area to include both trigger and actions */
.entry-actions-trigger:hover .entry-actions,
.entry-actions-trigger:hover .entry-actions:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* Create invisible bridge between trigger and actions */
.entry-actions-trigger::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  width: 0.5rem;
  height: 100%;
  transform: translateY(-50%);
  background: transparent;
  z-index: 9;
}

.entry-actions-trigger:hover::before {
  right: -0.5rem;
}

/* Ellipsis color classes based on answer line count */
.entry-actions-trigger.ellipsis-green {
  background: #dcfce7; /* Light green */
  border-color: #bbf7d0;
}

.entry-actions-trigger.ellipsis-yellow {
  background: #fed7aa; /* Light orange */
  border-color: #fdba74;
}

.entry-actions-trigger.ellipsis-orange {
  background: #fca5a5; /* Slightly darker red */
  border-color: #f87171;
}

/* Dark theme variants */
[data-theme="dark"] .entry-actions-trigger.ellipsis-green {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .entry-actions-trigger.ellipsis-yellow {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.3);
}

[data-theme="dark"] .entry-actions-trigger.ellipsis-orange {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.3);
}

/* Answer first line that shows on card hover */
.answer-first-line-hover {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0 0;
  font-style: italic;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.entry-card:hover .answer-first-line-hover {
  opacity: 1;
  visibility: visible;
}

.entry-content {
  transition: var(--transition);
}

.entry-link {
  color: var(--primary-blue);
  text-decoration: none;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  transition: var(--transition);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  background: rgba(59, 130, 246, 0.05);
  border-radius: var(--border-radius-full);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.entry-link:hover {
  background: var(--primary-blue);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.entry-tag {
  background: var(--gradient-secondary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.entry-tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.entry-tag:nth-child(2n) {
  background: var(--gradient-primary);
}

.entry-tag:nth-child(3n) {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--primary-blue) 100%);
}

.entry-tag:nth-child(4n) {
  background: linear-gradient(135deg, var(--warning-color) 0%, var(--accent-purple) 100%);
}

.entry-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.entry-controls {
  display: flex;
  gap: 0.75rem;
}

.control-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.625rem;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.control-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/*.control-btn.active {
  color: white;
}
*/
.control-btn.starred {
  background: var(--secondary-blue);
  border-color: var(--secondary-blue);
  color: white;
}

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

.control-btn:first-child:hover {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

.control-btn:nth-child(2):hover {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.control-btn:nth-child(4):hover {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: white;
}

/* ========================================
   NO ENTRIES STATE
   ======================================== */

.no-entries {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border-radius: var(--border-radius-lg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.no-entries i {
  font-size: 5rem;
  margin-bottom: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.7;
}

.no-entries p {
  font-size: 1.25rem;
  font-weight: 500;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
  .modal-content {
    max-width: 95%;
  }
}

@media (max-width: 768px) and (min-width: 431px) {
  .container {
    padding: 0.5rem;
    position: relative;
    z-index: 1;
  }

  .header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    margin: -0.5rem -0.5rem 2rem -0.5rem;
    padding: 1.5rem 1rem;
  }

  .header-left,
  .header-right {
    justify-content: center;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
  }

  .filter-group {
    width: 100%;
  }

  .search-input,
  .select-input {
    min-width: auto;
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .entries-container.grid-view {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .answer-actions {
    flex-direction: column;
  }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(12px);
    padding: 2rem;
    overflow-y: auto; /* Allow scrolling within modal overlay */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

.modal-content {
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    margin: auto;
    position: relative;
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

/* ========================================
   ENHANCED ANIMATIONS
   ======================================== */

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

.entry-card {
  animation: fadeIn 0.4s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content {
  animation: modalFadeIn 0.3s ease-out;
}

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

.form-container {
  animation: slideInUp 0.4s ease-out;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: var(--shadow-glow);
  }
  50% {
    box-shadow: var(--shadow-xl);
  }
}

.btn-primary:hover {
  animation: glowPulse 2s ease-in-out infinite;
}

/* ========================================
   SCROLLBAR HIDDEN
   ======================================== */

::-webkit-scrollbar {
  display: none;
}

body {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* ========================================
   TRIX EDITOR OVERRIDE STYLES
   ======================================== */

trix-editor {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

trix-editor:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow);
}

/* Trix toolbar container */
trix-toolbar {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 0.5rem;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--shadow-sm);
}

/* Toolbar buttons */
trix-toolbar .trix-button {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: var(--transition-fast);
  margin: 0.25rem;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

trix-toolbar .trix-button:not(:disabled):hover {
  background: var(--primary-blue);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
}

/* Active toolbar buttons */
trix-toolbar .trix-button--active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* Hide file upload button */
trix-toolbar .trix-button-group--file-tools {
  display: none;
}

/* Remove default trix borders */
trix-toolbar .trix-button-group {
    border: none;
    border-radius: 0;
    margin-left: 5px;
}

/* ========================================
   IPHONE 14 PRO SAFARI OPTIMIZATIONS
   ======================================== */

/* iPhone 14 Pro specific optimizations */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .container {
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }
  
  .header {
    padding-top: max(1rem, env(safe-area-inset-top) + 1rem);
  }
}

/* iPhone 14 Pro specific media queries */
@media screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) {
  :root {
    --mobile-header-height: calc(env(safe-area-inset-top) + 60px);
  }
  
  .container {
    border-radius: 0;
    max-width: 100%;
  }
  
  .header {
    border-radius: 0;
    position: sticky;
    top: 0;
    z-index: 100;
  }
}

/* Enhanced touch targets for mobile */
@media (max-width: 430px) {
  .btn, .filter-btn, .page-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1rem;
  }
  
  .search-input, .select-input {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  input[type="text"], input[type="date"], select, textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari specific styles */
  .modal-overlay {
    position: fixed;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-content {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix for iOS Safari bounce scroll */
  body {
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
  }
  
  .container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100vh;
    position: relative;
  }
  
  /* Prevent iOS Safari from adding tap highlights */
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  
  /* Allow text selection where needed */
  .rich-editor, .answer-display, input, textarea {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
  }
}

/* Enhanced mobile breakpoints */
@media (max-width: 430px) {
  .container {
    padding: 0;
    border-radius: 0;
  }
  
  .header {
    border-radius: 0;
    margin: 0;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  .filters {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .filter-group {
    margin-bottom: 0.5rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .entry-card {
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
  }
  
  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    border-radius: var(--border-radius-lg);
  }
  
  .form-container {
    padding: 1rem;
  }
  
  .rich-editor {
    min-height: 200px;
  }
  
  /* Optimize text sizes for mobile */
  .entry-title {
    font-size: 1.125rem;
    line-height: 1.4;
  }
  
  .entry-content {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  
  /* Better spacing for mobile */
  .entry-meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .entry-tags {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Landscape orientation optimizations for iPhone 14 Pro */
@media screen and (max-width: 852px) and (orientation: landscape) {
  .header {
    padding: 0.75rem 1rem;
  }
  
  .filters {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.75rem;
  }
  
  .filter-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
  }
  
  .modal-content {
    max-height: calc(100vh - 1rem);
    margin: 0.5rem;
  }
}

/* Dark mode optimizations for OLED displays */
@media (prefers-color-scheme: dark) {
  [data-theme="dark"] {
    --bg-primary: #000000; /* True black for OLED */
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
  }
}

/* Touch feedback styles */
.touch-active {
  transform: scale(0.95);
  opacity: 0.8;
  transition: all 0.1s ease;
}

/* Mobile device specific styles */
.mobile-device .container {
  -webkit-overflow-scrolling: touch;
}

.mobile-device .modal-content {
  -webkit-overflow-scrolling: touch;
}

/* iOS device specific styles */
.ios-device {
  -webkit-text-size-adjust: 100%;
}

.ios-device .container {
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
}

/* Safari browser specific styles */
.safari-browser input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

/* Keyboard open state */
.keyboard-open .header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.keyboard-open .main-content {
  margin-top: var(--mobile-header-height, 80px);
}

/* Safe area support */
.has-safe-area .container {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* PWA standalone mode */
@media (display-mode: standalone) {
  .container {
    border-radius: 0;
  }
  
  .header {
    border-radius: 0;
  }
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-primary: #000000;
    --bg-primary: #ffffff;
  }
  
  [data-theme="dark"] {
    --border-color: #ffffff;
    --text-primary: #ffffff;
    --bg-primary: #000000;
  }
}

kbd {
    background: var(--neutral-200);
    color: var(--text-primary);
    padding: 0.2em 0.4em;
    border-radius: 0.25em;
    font-family: monospace;
    font-size: 0.9em;
    border: 1px solid var(--neutral-300);
    box-shadow: 0 1px 0 var(--neutral-300);
}

.keyboard-hint {
    opacity: 0.7;
    transition: opacity 0.3s;
}

.modal-content:hover .keyboard-hint {
    opacity: 1;
}

/* Dark mode kbd styling */
[data-theme="dark"] kbd {
    background: var(--neutral-700);
    border-color: var(--neutral-600);
    box-shadow: 0 1px 0 var(--neutral-600);
}


/* Add this to your styles.css file */
.answer-preview {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.875em;
    font-style: italic;
}

.entry-card.collapsed .answer-preview {
    display: inline;
}

.entry-card:not(.collapsed) .answer-preview {
    display: none;
}


.answer-first-line {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0 0;
    font-style: italic;
    line-height: 1.4;
}

.entry-card.collapsed .answer-first-line {
    display: block;
}

.entry-card:not(.collapsed) .answer-first-line {
    display: none;
}

.starry {
  background-color: #f0f0f0; /* Or your desired background color */
}

.starry::before {
  background: linear-gradient(
    -65deg,
    rgba(255, 255, 255, 0) 70%,
    rgba(255, 255, 255, 0.5) 90%,
    rgba(255, 255, 255, 0) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}



.flex-together {
  display: flex; /* or display: grid; */
  width: 100%; /* Optional: Set container width */
}

.flex-together1 {
  flex-grow: 2; /* or grid-column: span 2; */
}

.flex-together2 {
  padding-left: 1rem;
  flex-grow: 1; /* or grid-column: span 1; */
}

/* Styles for Profile Settings in Modal */
.profile-settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 40px;
    padding: 0.75rem;
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.profile-setting-item {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.delete-profile-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0.25rem;
    line-height: 1;
    font-size: 1.25rem;
    font-weight: bold;
    transition: var(--transition-fast);
}

.delete-profile-btn:hover {
    color: var(--danger-color);
    transform: scale(1.1);
}

