/* ========================================
   RFC Radar - Soft Luxury Theme
   A refined, calm, premium curation experience
   ======================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Warm Neutrals */
  --bg-cream: #FAF8F5;
  --bg-warm: #F5F2EE;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FDFCFA;

  /* Text Hierarchy */
  --text-charcoal: #2C2825;
  --text-warm-gray: #6B6560;
  --text-muted: #9E9892;
  --text-light: #C4BEB8;

  /* Accent Colors */
  --accent-terracotta: #C17F59;
  --accent-terracotta-light: #F5EBE4;
  --accent-sage: #8B9E7E;
  --accent-sage-light: #EEF2EB;
  --accent-plum: #9B7B8E;
  --accent-plum-light: #F3EEF1;
  --accent-sand: #D4C4A8;

  /* Functional */
  --accent-success: #7A9E7E;
  --accent-success-light: #EDF4EE;
  --accent-danger: #C17B7B;
  --accent-danger-light: #F8EEEE;

  /* Shadows - Soft & Organic */
  --shadow-sm: 0 2px 8px rgba(44, 40, 37, 0.04);
  --shadow-md: 0 8px 24px rgba(44, 40, 37, 0.06);
  --shadow-lg: 0 16px 48px rgba(44, 40, 37, 0.08);
  --shadow-glow: 0 0 40px rgba(193, 127, 89, 0.08);

  /* Borders */
  --border-light: rgba(44, 40, 37, 0.06);
  --border-medium: rgba(44, 40, 37, 0.1);

  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Spacing Scale */
  --space-xs: 0.375rem;
  --space-sm: 0.625rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-cream: #1A1918;
  --bg-warm: #232220;
  --bg-card: #2A2928;
  --bg-card-hover: #323130;

  --text-charcoal: #F5F2EE;
  --text-warm-gray: #A8A4A0;
  --text-muted: #7A7672;
  --text-light: #5A5652;

  --border-light: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);

  /* Dark mode accent adjustments - more muted */
  --accent-terracotta-light: rgba(193, 127, 89, 0.15);
  --accent-sage-light: rgba(139, 158, 126, 0.12);
  --accent-plum-light: rgba(155, 123, 142, 0.12);
  --accent-success-light: rgba(122, 158, 126, 0.12);
  --accent-danger-light: rgba(193, 123, 123, 0.12);
}

/* ========================================
   Base Styles
   ======================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-cream);
  color: var(--text-charcoal);
  min-height: 100vh;
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle Background Texture */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(193, 127, 89, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 158, 126, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ========================================
   Password Screen
   ======================================== */

.password-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.password-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.password-card {
  background: var(--bg-card);
  padding: var(--space-3xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: floatIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.password-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-terracotta-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  color: var(--accent-terracotta);
}

.password-icon svg {
  width: 28px;
  height: 28px;
}

.password-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-charcoal);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}

.password-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}

.password-input-group {
  position: relative;
  margin-bottom: var(--space-lg);
}

.password-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-warm);
  color: var(--text-charcoal);
  text-align: center;
  letter-spacing: 0.2em;
  transition: var(--transition-smooth);
}

.password-input:focus {
  outline: none;
  border-color: var(--accent-terracotta);
  box-shadow: var(--shadow-glow);
  background: var(--bg-card);
}

.password-input.error {
  border-color: var(--accent-danger);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.password-submit {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-terracotta);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.password-submit:hover {
  background: #B5724A;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.password-error {
  color: var(--accent-danger);
  font-size: 0.8rem;
  margin-top: var(--space-sm);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.password-error.show {
  opacity: 1;
}

/* ========================================
   Top Bar
   ======================================== */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.logo {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-charcoal);
  letter-spacing: -0.03em;
}

.logo span {
  color: var(--accent-terracotta);
  font-style: italic;
}

.stats-pill {
  display: flex;
  gap: var(--space-xl);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stats-pill strong {
  color: var(--text-charcoal);
  font-weight: 600;
  font-size: 0.9rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.theme-toggle:hover {
  border-color: var(--accent-terracotta);
  color: var(--accent-terracotta);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

.btn-refresh {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent-terracotta);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-refresh:hover {
  background: #B5724A;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-refresh.loading {
  opacity: 0.7;
  pointer-events: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.hidden {
  display: none;
}

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

/* ========================================
   Main Container
   ======================================== */

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-xl);
  animation: fadeInUp 0.5s ease;
}

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

/* ========================================
   Tabs & Controls Row
   ======================================== */

.tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  align-items: center;
  flex-wrap: wrap;
}

.tab {
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab:hover {
  border-color: var(--accent-terracotta);
  color: var(--text-charcoal);
}

.tab.active {
  background: var(--text-charcoal);
  border-color: var(--text-charcoal);
  color: white;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  color: var(--text-charcoal);
}

.view-btn.active {
  background: var(--bg-warm);
  color: var(--text-charcoal);
  box-shadow: var(--shadow-sm);
}

.btn-export {
  background: var(--bg-card);
  color: var(--text-charcoal);
  border: 1px solid var(--border-light);
  padding: var(--space-sm) var(--space-lg);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: none;
}

.btn-export:hover {
  border-color: var(--accent-terracotta);
  color: var(--accent-terracotta);
}

/* ========================================
   Filters
   ======================================== */

.filters {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  padding: var(--space-lg);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.filter-group label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.filter-select {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-charcoal);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  min-width: 120px;
}

.filter-select:hover {
  border-color: var(--accent-terracotta);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 3px rgba(193, 127, 89, 0.1);
}

/* ========================================
   Cards Grid
   ======================================== */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-lg);
}

/* Staggered Animation */
.cards-grid .card {
  animation: cardFadeIn 0.4s ease backwards;
}

.cards-grid .card:nth-child(1) { animation-delay: 0.05s; }
.cards-grid .card:nth-child(2) { animation-delay: 0.1s; }
.cards-grid .card:nth-child(3) { animation-delay: 0.15s; }
.cards-grid .card:nth-child(4) { animation-delay: 0.2s; }
.cards-grid .card:nth-child(5) { animation-delay: 0.25s; }
.cards-grid .card:nth-child(6) { animation-delay: 0.3s; }
.cards-grid .card:nth-child(7) { animation-delay: 0.35s; }
.cards-grid .card:nth-child(8) { animation-delay: 0.4s; }
.cards-grid .card:nth-child(n+9) { animation-delay: 0.45s; }

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

/* ========================================
   Card
   ======================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition-smooth);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.card.removing {
  animation: slideOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOut {
  to {
    transform: translateX(30px) scale(0.95);
    opacity: 0;
  }
}

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

.badge-group {
  display: flex;
  gap: var(--space-sm);
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-score {
  min-width: 32px;
  text-align: center;
  font-size: 0.7rem;
}

.badge-score.high {
  background: var(--accent-success-light);
  color: var(--accent-success);
}

.badge-score.medium {
  background: var(--accent-terracotta-light);
  color: var(--accent-terracotta);
}

.badge-score.low {
  background: var(--accent-plum-light);
  color: var(--accent-plum);
}

.badge-type {
  background: var(--accent-sage-light);
  color: var(--accent-sage);
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: var(--space-sm);
  color: var(--text-charcoal);
  letter-spacing: -0.01em;
}

.card-hook {
  font-style: italic;
  color: var(--accent-terracotta);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.card-why {
  font-size: 0.85rem;
  color: var(--text-warm-gray);
  padding: var(--space-md);
  background: var(--accent-sage-light);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  line-height: 1.6;
  border-left: 3px solid var(--accent-sage);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.tag {
  font-size: 0.7rem;
  padding: 3px 8px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.card-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.card-source a {
  color: var(--accent-terracotta);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.card-source a:hover {
  color: var(--accent-plum);
}

.card-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-action {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-keep {
  background: var(--accent-success-light);
  color: var(--accent-success);
  border-color: transparent;
}

.btn-keep:hover {
  background: var(--accent-success);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-trash {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
  border-color: transparent;
}

.btn-trash:hover {
  background: var(--accent-danger);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-restore {
  flex: 1;
  background: var(--accent-plum-light);
  color: var(--accent-plum);
  border: 1px solid transparent;
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-restore:hover {
  background: var(--accent-plum);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ========================================
   List View
   ======================================== */

.list-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.list-view .list-item {
  animation: cardFadeIn 0.4s ease backwards;
}

.list-view .list-item:nth-child(1) { animation-delay: 0.03s; }
.list-view .list-item:nth-child(2) { animation-delay: 0.06s; }
.list-view .list-item:nth-child(3) { animation-delay: 0.09s; }
.list-view .list-item:nth-child(4) { animation-delay: 0.12s; }
.list-view .list-item:nth-child(n+5) { animation-delay: 0.15s; }

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  transition: var(--transition-smooth);
}

.list-item:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.list-item.removing {
  animation: slideOut 0.3s ease forwards;
}

.list-item-score {
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-charcoal);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.75rem;
}

.list-item-date {
  color: var(--text-muted);
}

.list-item-source {
  color: var(--accent-terracotta);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.list-item-source:hover {
  color: var(--accent-plum);
}

.list-item-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.btn-action.btn-sm {
  flex: 0;
  padding: 6px 14px;
  font-size: 0.75rem;
}

.btn-restore.btn-sm {
  padding: 6px 14px;
  font-size: 0.75rem;
  flex: 0;
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}

.empty-state h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-warm-gray);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 0.9rem;
}

/* ========================================
   Toast
   ======================================== */

.toast {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--accent-success);
  border-radius: var(--radius-md);
  color: var(--text-charcoal);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition-smooth);
  z-index: 1000;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ========================================
   Keyboard Shortcuts Hint
   ======================================== */

.shortcuts-hint {
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  display: flex;
  gap: var(--space-md);
  font-size: 0.7rem;
  color: var(--text-light);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.shortcuts-hint:hover {
  opacity: 1;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shortcut kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
  }

  .top-bar {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .stats-pill {
    order: 2;
    gap: var(--space-lg);
  }

  .top-actions {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .container {
    padding: var(--space-md);
  }

  .tabs {
    flex-direction: column;
    align-items: stretch;
  }

  .tab {
    text-align: center;
  }

  .view-toggle {
    margin-left: 0;
    margin-top: var(--space-sm);
    justify-content: center;
  }

  .btn-export {
    width: 100%;
    text-align: center;
  }

  .filters {
    flex-direction: column;
    padding: var(--space-md);
  }

  .filter-group {
    width: 100%;
  }

  .filter-select {
    flex: 1;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .card {
    padding: var(--space-md);
  }

  .card-title {
    font-size: 1.125rem;
  }

  .list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .list-item-actions {
    width: 100%;
    margin-top: var(--space-sm);
  }

  .list-item-actions .btn-action,
  .list-item-actions .btn-restore {
    flex: 1;
  }

  .shortcuts-hint {
    display: none;
  }

  .toast {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
  }
}

@media (max-width: 480px) {
  .password-card {
    padding: var(--space-xl);
  }

  .password-title {
    font-size: 1.5rem;
  }

  .badge-group {
    flex-wrap: wrap;
  }

  .card-actions {
    flex-direction: column;
  }

  .btn-action,
  .btn-restore {
    width: 100%;
  }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .top-bar,
  .filters,
  .card-actions,
  .shortcuts-hint,
  .toast,
  .password-screen {
    display: none !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ========================================
   Accessibility
   ======================================== */

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

/* Focus Visible Styles */
:focus-visible {
  outline: 2px solid var(--accent-terracotta);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* ========================================
   Dark Mode Contrast Fixes
   ======================================== */

[data-theme="dark"] {
  /* Brighter accent colors for text in dark mode */
  --accent-terracotta: #E8A070;
  --accent-sage: #A8C49A;
  --accent-plum: #B8909E;
  --accent-success: #8CB090;
  --accent-danger: #D89090;
}

[data-theme="dark"] .btn-keep {
  background: rgba(140, 176, 144, 0.18);
  color: var(--accent-success);
  border: 1px solid rgba(140, 176, 144, 0.3);
}

[data-theme="dark"] .btn-keep:hover {
  background: var(--accent-success);
  color: #1A1918;
}

[data-theme="dark"] .btn-trash {
  background: rgba(216, 144, 144, 0.18);
  color: var(--accent-danger);
  border: 1px solid rgba(216, 144, 144, 0.3);
}

[data-theme="dark"] .btn-trash:hover {
  background: var(--accent-danger);
  color: #1A1918;
}

[data-theme="dark"] .btn-restore {
  background: rgba(184, 144, 158, 0.18);
  color: var(--accent-plum);
  border: 1px solid rgba(184, 144, 158, 0.3);
}

[data-theme="dark"] .btn-restore:hover {
  background: var(--accent-plum);
  color: #1A1918;
}

/* Badge contrast in dark mode */
[data-theme="dark"] .badge-score.high {
  background: rgba(140, 176, 144, 0.2);
  color: #A8D0AC;
}

[data-theme="dark"] .badge-score.medium {
  background: rgba(232, 160, 112, 0.2);
  color: #F0B888;
}

[data-theme="dark"] .badge-score.low {
  background: rgba(184, 144, 158, 0.2);
  color: #D0A8B8;
}

[data-theme="dark"] .badge-type {
  background: rgba(168, 196, 154, 0.2);
  color: #B8D8A8;
}

/* Card "why" section border in dark mode */
[data-theme="dark"] .card-why {
  border-left-color: var(--accent-sage);
}

/* Toast in dark mode */
[data-theme="dark"] .toast {
  border-color: var(--accent-success);
  background: var(--bg-card);
}

/* Keyboard shortcuts in dark mode */
[data-theme="dark"] .shortcut kbd {
  background: var(--bg-warm);
  border-color: var(--border-medium);
  color: var(--text-warm-gray);
}

/* Links in dark mode - ensure visibility */
[data-theme="dark"] .card-source a,
[data-theme="dark"] .list-item-source {
  color: var(--accent-terracotta);
}

[data-theme="dark"] .card-source a:hover,
[data-theme="dark"] .list-item-source:hover {
  color: var(--accent-plum);
}

/* Card hook text in dark mode */
[data-theme="dark"] .card-hook {
  color: var(--accent-terracotta);
}

/* Ensure card titles are readable */
[data-theme="dark"] .card-title,
[data-theme="dark"] .list-item-title {
  color: var(--text-charcoal);
}

/* Filter selects in dark mode */
[data-theme="dark"] .filter-select {
  background: var(--bg-warm);
  color: var(--text-charcoal);
  border-color: var(--border-medium);
}

[data-theme="dark"] .filter-select option {
  background: var(--bg-card);
  color: var(--text-charcoal);
}

/* Tab active state in dark mode */
[data-theme="dark"] .tab.active {
  background: var(--text-charcoal);
  border-color: var(--text-charcoal);
  color: #1A1918;
}

/* View toggle active state in dark mode */
[data-theme="dark"] .view-btn.active {
  background: var(--bg-warm);
  color: var(--text-charcoal);
}

/* Theme toggle button in dark mode */
[data-theme="dark"] .theme-toggle {
  border-color: var(--border-medium);
  color: var(--text-warm-gray);
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: var(--accent-terracotta);
  color: var(--accent-terracotta);
}
