/**
 * Ryana Main Stylesheet - Version 2.0
 * Updated: Typography (Google Fonts) + New Color Palette
 */

/* ==================== GOOGLE FONTS ==================== */
@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@700&family=Inter:wght@400;500;600&family=Fira+Mono:wght@400;500&display=swap');

/* ==================== CSS VARIABLES ==================== */
:root {
  /* New Color Palette - Light Theme (from coolors.co) */
  --color-teal: #0e7c7b;
  --color-tropical-teal: #17bebb;
  --color-frosted-mint: #d4f4dd;
  --color-raspberry: #d62246;
  --color-blackberry: #4b1d3f;
  
  /* Light Theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --accent-primary: var(--color-teal);
  --accent-secondary: var(--color-tropical-teal);
  --accent-light: var(--color-frosted-mint);
  --accent-highlight: var(--color-raspberry);
  --accent-dark: var(--color-blackberry);
  --success: #48bb78;
  --error: var(--color-raspberry);
  --warning: #ed8936;
  
  /* Typography */
  --font-title: 'Zilla Slab', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Mono', 'Courier New', monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Borders */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-full: 999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-medium: 250ms ease;
  --transition-slow: 350ms ease;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-primary: #1a1d2e;
  --bg-secondary: #222736;
  --bg-tertiary: #2a2f42;
  --text-primary: #e8ecf1;
  --text-secondary: #cbd5e0;
  --text-muted: #a0aec0;
  --border-color: #374151;
  --accent-primary: var(--color-tropical-teal);
  --accent-secondary: var(--color-teal);
  --accent-light: #2d5555;
  --accent-highlight: #ff4d6d;
  --accent-dark: #7c3f6f;
  --success: #48bb78;
  --error: #ff4d6d;
  --warning: #ed8936;
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

code, pre {
  font-family: var(--font-mono);
}

/* ==================== LOADING SCREEN ==================== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
}

.loading-content h1 {
  font-size: 3rem;
  margin-bottom: var(--spacing-sm);
  color: var(--accent-primary);
}

.loading-content p {
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== APP CONTAINER ==================== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ==================== HEADER ==================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-family: var(--font-title);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.app-tagline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  font-weight: 400;
}

.header-right {
  display: flex;
  gap: var(--spacing-sm);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: var(--spacing-sm);
  cursor: pointer;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
  font-size: var(--text-lg);
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

/* ==================== MAIN CONTENT ==================== */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg);
  overflow-y: auto;
}

.sidebar-nav {
  flex: 1;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: transparent;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  font-family: var(--font-body);
  font-weight: 500;
}

.nav-btn:hover {
  background: var(--bg-tertiary);
}

.nav-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.nav-icon {
  font-size: var(--text-xl);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-label {
  font-size: var(--text-sm);
  font-weight: 500;
}

.nav-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--spacing-lg) 0;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  transition: all var(--transition-fast);
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--accent-primary);
}

.btn-small {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--text-xs);
}

/* ==================== CONTENT AREA ==================== */
.content-area {
  flex: 1;
  padding: var(--spacing-xl);
  overflow-y: auto;
  background: var(--bg-primary);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
}

.view-header h2 {
  font-family: var(--font-title);
  font-size: var(--text-2xl);
  color: var(--text-primary);
}

.count-badge {
  background: var(--accent-primary);
  color: white;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--border-radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
}

/* ==================== SEARCH & FILTERS ==================== */
.search-container {
  position: relative;
  margin-bottom: var(--spacing-md);
}

.search-input {
  width: 100%;
  padding: var(--spacing-md);
  padding-right: 40px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-md);
  font-size: var(--text-base);
  font-family: var(--font-body);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

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

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: var(--text-xl);
  color: var(--text-muted);
  padding: var(--spacing-xs);
}

.clear-search-btn:hover {
  color: var(--text-primary);
}

.filter-bar {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

.filter-select {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ==================== SNIPPETS GRID ==================== */
.snippets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-xl);
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-2xl) 0;
  color: var(--text-muted);
  font-family: var(--font-body);
}

/* ==================== MODALS ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.modal-large {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: var(--text-xl);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: var(--text-2xl);
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-footer {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
  justify-content: flex-end;
}

/* ==================== FORMS ==================== */
.snippet-form,
.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group label {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast);
}

.form-group textarea {
  font-family: var(--font-mono);
  resize: vertical;
  line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.form-group small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

/* ==================== SNIPPET DETAIL ==================== */
.snippet-detail {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.detail-description h4,
.detail-code h4,
.detail-errors h4,
.detail-usage h4 {
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
  font-family: var(--font-title);
  font-size: var(--text-lg);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.detail-code pre {
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

.detail-code code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.error-info {
  background: var(--bg-secondary);
  padding: var(--spacing-md);
  border-radius: var(--border-radius-md);
  margin-bottom: var(--spacing-md);
  border-left: 4px solid var(--error);
}

.error-solution {
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--border-color);
}

.error-links {
  margin-top: var(--spacing-sm);
}

.error-links ul {
  margin: var(--spacing-xs) 0;
  padding-left: var(--spacing-lg);
}

.error-links a {
  color: var(--accent-primary);
  text-decoration: none;
  font-family: var(--font-body);
}

.error-links a:hover {
  text-decoration: underline;
}

.detail-usage p {
  margin: var(--spacing-xs) 0;
  font-family: var(--font-body);
}

.detail-actions {
  display: flex;
  gap: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

/* ==================== IMPORT/EXPORT ==================== */
.import-export-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.export-section,
.import-section {
  padding: var(--spacing-xl);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
}

.export-section h3,
.import-section h3 {
  margin-bottom: var(--spacing-sm);
  font-family: var(--font-title);
}

.export-section p,
.import-section p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  font-family: var(--font-body);
}

.export-section button,
.import-section button {
  margin-right: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.import-status {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
}

.import-preview {
  background: var(--bg-primary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.import-options {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
}

.import-options label {
  display: block;
  margin-bottom: var(--spacing-sm);
  cursor: pointer;
  font-family: var(--font-body);
}

.import-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.import-success {
  color: var(--success);
}

/* ==================== USAGE SECTION ==================== */
.usage-section {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: var(--spacing-md);
  cursor: pointer;
}

.usage-section summary {
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
}

.usage-section[open] summary {
  margin-bottom: var(--spacing-md);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.toast {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--spacing-sm);
  min-width: 250px;
  max-width: 400px;
  border-left: 4px solid var(--accent-primary);
  opacity: 1;
  transition: opacity var(--transition-medium);
  font-family: var(--font-body);
  border: 1px solid var(--border-color);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--error);
}

.toast-info {
  border-left-color: var(--accent-primary);
}

.toast-clickable {
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.toast-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.subject-snippet-count span {
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.subject-snippet-count span:hover {
  background: var(--accent-primary);
  color: white;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    height: 100%;
    transition: left var(--transition-medium);
    z-index: 100;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .snippets-grid {
    grid-template-columns: 1fr;
  }
  
  .subjects-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
  }
  
  .content-area {
    padding: var(--spacing-md);
  }
  
  .app-header {
    padding: var(--spacing-md);
  }
}

/**
 * Ryana CSS Fixes V3
 * Replace the hotfixes section in main.css with this updated version
 */

/* ==================== FIX 1: Language Badge - ALWAYS RED/ACCENT COLOR ==================== */

/* All language badges use accent highlight (raspberry) color */
.snippet-language {
  background: var(--accent-highlight) !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Ensure consistency in both themes */
[data-theme="light"] .snippet-language,
[data-theme="dark"] .snippet-language {
  background: var(--accent-highlight) !important;
  color: white !important;
}

/* Error cards keep the error color */
.error-card .snippet-language {
  background: var(--error) !important;
  color: white !important;
}

/* ==================== FIX 2: Modal Button Consistency ==================== */

/* All modal buttons same size */
.modal-footer .btn {
  min-width: 120px;
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: var(--text-sm);
  font-weight: 600;
}

.modal-footer .btn-primary {
  background: var(--accent-primary);
  color: white;
}

.modal-footer .btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.modal-footer .btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: var(--text-sm);
  font-weight: 600;
}

.modal-footer .btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

/* ==================== FIX 3: Improved Card Layout with Visual Separation ==================== */

.snippet-card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  border-left: 5px solid var(--subject-color);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  min-height: 220px;
}

/* Add subtle top border for visual interest */
.snippet-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--subject-color);
  opacity: 0.3;
}

.snippet-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ==================== FIX 4: Tags with Colored Backgrounds ==================== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-mono);
  margin: 0;
  background: var(--subject-color);
  color: #fefefe;
  border: none;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* For light subject colors, use darker text */
.subject-4 .tag,
.subject-5 .tag {
  color: var(--subject-color-contrast);
}

/* ==================== FIX 5: Modal Detail View - Better Visual Hierarchy ==================== */

/* Make main title larger and more prominent */
.modal-header h2 {
  font-family: var(--font-title);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* Section headings smaller */
.detail-description h4,
.detail-code h4,
.detail-errors h4,
.detail-usage h4 {
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
  font-family: var(--font-title);
  font-size: var(--text-base);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--accent-primary);
  padding-bottom: var(--spacing-xs);
}

/* Better badge layout in detail view */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
}

/* Ensure all badges same height */
.detail-meta .snippet-language,
.detail-meta .snippet-subject,
.detail-meta .tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  line-height: 1;
}

/* ==================== FIX 6: Code Display Readability ==================== */

.detail-code pre {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.detail-code code {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ==================== FIX 7: Subject Cards - Bottom Section Clarity ==================== */

.subject-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  border-top: 6px solid var(--subject-color);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 240px;
}

.subject-name {
  font-family: var(--font-title);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.subject-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
  flex: 1;
  min-height: 60px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.subject-stats {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-sm);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
}

/* Color preview with label */
.subject-color-preview {
  width: 100%;
  height: 50px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(
    135deg,
    var(--subject-color) 0%,
    var(--subject-color-light) 50%,
    var(--subject-color-lighter) 100%
  );
  margin-top: var(--spacing-sm);
  border: 2px solid var(--subject-color);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Add snippet count to subject card (JS will populate this) */
.subject-snippet-count {
  display: flex;
  justify-content: space-around;
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

.subject-snippet-count span {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  transition: background var(--transition-fast);
}

.subject-snippet-count span:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ==================== FIX 8: Form Elements Consistency ==================== */

.form-group textarea {
  font-family: var(--font-mono);
  resize: vertical;
  line-height: 1.5;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ==================== FIX 9: Responsive - Show Quick Actions on Mobile ==================== */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    height: 100%;
    transition: left var(--transition-medium);
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  /* Quick actions should be visible even when sidebar is closed */
  .quick-actions {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 99;
    flex-direction: row;
    gap: var(--spacing-sm);
  }
  
  .quick-actions .btn {
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    font-size: var(--text-lg);
  }
  
  .quick-actions .btn span {
    display: none;
  }
  
  .quick-actions .btn::before {
    content: '+';
    font-size: var(--text-2xl);
    font-weight: bold;
  }
  
  .snippets-grid {
    grid-template-columns: 1fr;
  }
  
  .subjects-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
  }
  
  .content-area {
    padding: var(--spacing-md);
  }
  
  .app-header {
    padding: var(--spacing-md);
  }
}

/**
 * ADDED THESE STYLES TO main.css FILE
 * Subject Modal, Color Picker, Update Notification, SVG Icons
 */

/* ==================== SVG ICONS IN NAVIGATION ==================== */

.nav-svg-icon {
  display: block;
  width: 24px;
  height: 24px;
}

/* Color SVGs based on theme */
.nav-svg-icon path,
.nav-svg-icon circle,
.nav-svg-icon rect,
.nav-svg-icon polygon {
  stroke: var(--text-primary);
  transition: stroke var(--transition-fast);
}

.nav-btn.active .nav-svg-icon path,
.nav-btn.active .nav-svg-icon circle,
.nav-btn.active .nav-svg-icon rect,
.nav-btn.active .nav-svg-icon polygon {
  stroke: white;
}

/* ==================== SUBJECT MODAL FORM ==================== */

.subject-modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

/* ==================== COLOR PICKER GRID ==================== */

.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-swatch.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: scale(1.05);
}

.check-mark {
  color: white;
  font-size: var(--text-xl);
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Special handling for light colors */
.color-swatch[data-color-index="4"] .check-mark,
.color-swatch[data-color-index="5"] .check-mark {
  color: #333;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* ==================== DELETE BUTTON ==================== */

.btn-danger {
  background: var(--error);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #d32f2f;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ==================== UPDATE NOTIFICATION ==================== */

.update-notification {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 3000;
  background: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.update-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.update-content strong {
  font-family: var(--font-title);
  font-size: var(--text-lg);
  color: var(--accent-primary);
}

.update-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.update-content button {
  margin-top: var(--spacing-sm);
  margin-right: var(--spacing-sm);
}

/* ==================== RESPONSIVE - COLOR PICKER ==================== */

@media (max-width: 768px) {
  .color-picker-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-sm);
  }
  
  .update-notification {
    left: var(--spacing-md);
    right: var(--spacing-md);
    max-width: none;
  }
}

/* FIX: Tags in light mode */
[data-theme="light"] .tag {
  background: var(--subject-color);
  color: white !important;
}

/* For light subject colors, use dark text */
[data-theme="light"] .subject-4 .tag,
[data-theme="light"] .subject-5 .tag {
  color: #333 !important;
}