/*
  Pocket Clone - Literary Minimalism
  Warm, refined, readable - like a curated reading room
*/

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;1,9..144,400&family=Source+Sans+3:wght@400;500;600&display=swap');

/* ═══════════════════════════════════════════════════════════════
   Design Tokens
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Warm paper palette */
  --cream: #FAF7F2;
  --cream-dark: #F0EBE3;
  --warm-white: #FFFDFB;

  /* Ink tones */
  --ink: #2C2825;
  --ink-soft: #4A4542;
  --ink-muted: #7A7570;
  --ink-faint: #B5B0A8;

  /* Terracotta accent spectrum */
  --terracotta: #C85A3B;
  --terracotta-soft: #D97B5F;
  --terracotta-glow: rgba(200, 90, 59, 0.12);
  --terracotta-pale: #F5E6E0;

  /* Functional */
  --danger: #B8463A;
  --danger-soft: rgba(184, 70, 58, 0.1);

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, sans-serif;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(44, 40, 37, 0.04);
  --shadow-md: 0 4px 12px rgba(44, 40, 37, 0.06), 0 1px 3px rgba(44, 40, 37, 0.04);
  --shadow-lg: 0 12px 32px rgba(44, 40, 37, 0.08), 0 4px 8px rgba(44, 40, 37, 0.04);
  --shadow-card-hover: 0 16px 40px rgba(44, 40, 37, 0.1), 0 6px 12px rgba(44, 40, 37, 0.05);

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Sidebar */
  --sidebar-width: 240px;
}


/* ═══════════════════════════════════════════════════════════════
   Base & Reset
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;

  /* Subtle paper texture effect */
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(200, 90, 59, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(200, 90, 59, 0.02) 0%, transparent 50%);
}

#app {
  min-height: 100vh;
}


/* ═══════════════════════════════════════════════════════════════
   Auth Section
   ═══════════════════════════════════════════════════════════════ */

.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;

  /* Centered warm glow */
  background:
    radial-gradient(ellipse 600px 400px at 50% 40%, var(--terracotta-glow) 0%, transparent 70%),
    var(--cream);

  animation: authFadeIn 0.8s var(--ease-out);
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-container h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: var(--space-xs);

  /* Subtle text shadow for depth */
  text-shadow: 0 2px 20px rgba(200, 90, 59, 0.08);
}

.auth-container .tagline {
  font-size: 1.125rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-xl);
  font-weight: 400;
}

#auth-form {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

#auth-form input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--warm-white);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.25s var(--ease-out);
}

#auth-form input::placeholder {
  color: var(--ink-faint);
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  width: 100%;
  padding-right: 70px;
}

.show-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}

.show-password input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  accent-color: var(--terracotta);
  border-radius: 0;
}

.show-password:hover {
  color: var(--ink);
}

#auth-form input:focus {
  border-color: var(--terracotta-soft);
  box-shadow: 0 0 0 4px var(--terracotta-glow);
}

#auth-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--warm-white);
  background: var(--terracotta);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  position: relative;
  overflow: hidden;
}

#auth-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

#auth-btn:hover:not(:disabled) {
  background: var(--terracotta-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

#auth-btn:hover::before {
  opacity: 1;
}

#auth-btn:active:not(:disabled) {
  transform: translateY(0);
}

#auth-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-toggle {
  margin-top: var(--space-lg);
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.auth-toggle a {
  color: var(--terracotta);
  text-decoration: none;
  font-weight: 500;
  margin-left: var(--space-xs);
  transition: color 0.2s;
}

.auth-toggle a:hover {
  color: var(--terracotta-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.error {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  text-align: center;
  animation: shake 0.4s var(--ease-out);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}


/* ═══════════════════════════════════════════════════════════════
   Main Container
   ═══════════════════════════════════════════════════════════════ */

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) var(--space-2xl);
  animation: mainFadeIn 0.6s var(--ease-out);
}

@keyframes mainFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0 var(--space-xl);
  border-bottom: 1px solid var(--cream-dark);
  margin-bottom: var(--space-lg);
}

header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

#logout-btn {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: transparent;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

#logout-btn:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
  background: var(--warm-white);
}


/* ═══════════════════════════════════════════════════════════════
   App Layout (Sidebar + Main)
   ═══════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  gap: var(--space-xl);
}

.bucket-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: var(--space-md) 0;
}

.main-content {
  flex: 1;
  min-width: 0;
  overflow: visible;
}

#links-container {
  overflow: visible;
}


/* ═══════════════════════════════════════════════════════════════
   Bucket Sidebar
   ═══════════════════════════════════════════════════════════════ */

.bucket-item {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  position: relative;
}

.bucket-item:hover {
  background: var(--terracotta-glow);
}

.bucket-item.active {
  background: var(--terracotta-pale);
}

.bucket-item.active .bucket-name {
  color: var(--terracotta);
  font-weight: 600;
}

.bucket-name {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.bucket-count {
  font-size: 0.75rem;
  color: var(--ink-faint);
  background: var(--cream-dark);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: var(--space-sm);
  flex-shrink: 0;
}

.bucket-menu-btn {
  opacity: 0;
  background: none;
  border: none;
  padding: 4px;
  margin-left: var(--space-xs);
  cursor: pointer;
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bucket-item:hover .bucket-menu-btn {
  opacity: 1;
}

.bucket-menu-btn:hover {
  background: var(--cream-dark);
  color: var(--ink);
}

.bucket-divider {
  height: 1px;
  background: var(--cream-dark);
  margin: var(--space-sm) var(--space-md);
}

.bucket-header {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.new-bucket-section {
  margin-top: var(--space-sm);
  padding: 0 var(--space-md);
}

.new-bucket-btn {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1.5px dashed var(--cream-dark);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s var(--ease-out);
}

.new-bucket-btn:hover {
  border-color: var(--terracotta-soft);
  color: var(--terracotta);
  background: var(--terracotta-glow);
}

.new-bucket-form {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.new-bucket-form input {
  flex: 1;
  padding: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  border: 1.5px solid var(--terracotta-soft);
  border-radius: var(--radius-sm);
  background: var(--warm-white);
  outline: none;
}

.new-bucket-form input:focus {
  box-shadow: 0 0 0 3px var(--terracotta-glow);
}

.new-bucket-actions {
  display: flex;
  gap: 2px;
}

.new-bucket-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-confirm {
  background: var(--terracotta);
  color: white;
}

.btn-confirm:hover {
  background: var(--terracotta-soft);
}

.btn-cancel {
  background: var(--cream-dark);
  color: var(--ink-muted);
}

.btn-cancel:hover {
  background: var(--ink-faint);
  color: var(--ink);
}


/* ═══════════════════════════════════════════════════════════════
   Bucket Context Menu
   ═══════════════════════════════════════════════════════════════ */

.bucket-context-menu {
  position: fixed;
  background: var(--warm-white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 140px;
  padding: var(--space-xs);
}

.bucket-context-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.bucket-context-menu button:hover {
  background: var(--cream);
}

.bucket-context-menu button.danger {
  color: var(--danger);
}

.bucket-context-menu button.danger:hover {
  background: var(--danger-soft);
}


/* ═══════════════════════════════════════════════════════════════
   Mobile Filter Bar
   ═══════════════════════════════════════════════════════════════ */

.mobile-filter-bar {
  display: none;
  margin-bottom: var(--space-md);
}

.mobile-filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--warm-white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-filter-btn:hover {
  border-color: var(--ink-faint);
}

.mobile-filter-btn svg {
  color: var(--ink-muted);
}


/* ═══════════════════════════════════════════════════════════════
   Mobile Bucket Sheet
   ═══════════════════════════════════════════════════════════════ */

.mobile-bucket-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.3s, opacity 0.3s;
}

.mobile-bucket-sheet.open {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity 0.3s;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 40, 37, 0.4);
}

.sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--warm-white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 70vh;
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-out);
}

.mobile-bucket-sheet.open .sheet-content {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--cream-dark);
}

.sheet-header h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--ink);
}

.sheet-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  border: none;
  border-radius: 50%;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.sheet-close:hover {
  background: var(--cream-dark);
  color: var(--ink);
}

.mobile-bucket-list {
  padding: var(--space-md);
  overflow-y: auto;
  max-height: calc(70vh - 80px);
}

.mobile-bucket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-bucket-item:hover {
  background: var(--cream);
}

.mobile-bucket-item.active {
  background: var(--terracotta-pale);
  color: var(--terracotta);
  font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════
   Add Link Form
   ═══════════════════════════════════════════════════════════════ */

#add-link-form {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

#url-input {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--warm-white);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.25s var(--ease-out);
}

#url-input::placeholder {
  color: var(--ink-faint);
}

#url-input:focus {
  border-color: var(--terracotta-soft);
  box-shadow: 0 0 0 4px var(--terracotta-glow);
}

#url-input:disabled {
  opacity: 0.6;
}

#add-btn {
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--warm-white);
  background: var(--terracotta);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}

#add-btn:hover:not(:disabled) {
  background: var(--terracotta-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

#add-btn:active:not(:disabled) {
  transform: translateY(0);
}

#add-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}


/* ═══════════════════════════════════════════════════════════════
   Loading States
   ═══════════════════════════════════════════════════════════════ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.loading span {
  position: relative;
  padding-left: 28px;
}

.loading span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid var(--cream-dark);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ═══════════════════════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--ink-muted);
}

.empty-state p:first-child {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: var(--space-sm);
}

.empty-state .subtle {
  font-size: 0.9375rem;
  color: var(--ink-faint);
}


/* ═══════════════════════════════════════════════════════════════
   Links Grid
   ═══════════════════════════════════════════════════════════════ */

.links-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  overflow: visible;
}


/* ═══════════════════════════════════════════════════════════════
   Link Card
   ═══════════════════════════════════════════════════════════════ */

.link-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  background: var(--warm-white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: visible;
  z-index: 1;

  animation: cardSlideIn 0.4s var(--ease-out) backwards;
}

.link-card:has(.bucket-dropdown-menu.open) {
  z-index: 1000;
}

.card-link {
  display: grid;
  grid-template-columns: 80px 1fr 100px;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) 0 var(--space-sm) var(--space-md);
  text-decoration: none;
  color: inherit;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for multiple cards */
.link-card:nth-child(1) { animation-delay: 0s; }
.link-card:nth-child(2) { animation-delay: 0.05s; }
.link-card:nth-child(3) { animation-delay: 0.1s; }
.link-card:nth-child(4) { animation-delay: 0.15s; }
.link-card:nth-child(5) { animation-delay: 0.2s; }
.link-card:nth-child(6) { animation-delay: 0.25s; }

.link-card:hover {
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.link-card:active {
  transform: translateY(0);
}

/* Deleting state */
.link-card.deleting {
  opacity: 0.5;
  transform: scale(0.98);
  pointer-events: none;
}


/* Card Image */
.card-image {
  width: 80px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--cream-dark);
  flex-shrink: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
  image-rendering: -webkit-optimize-contrast;
}

.link-card:hover .card-image img {
  transform: scale(1.05);
}


/* Card Content */
.card-content {
  min-width: 0; /* Prevents text overflow */
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);

  /* Truncate to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

  transition: color 0.2s;
}

.link-card:hover .card-title {
  color: var(--terracotta);
}

.card-domain {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: lowercase;
}

.card-date {
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-align: right;
  white-space: nowrap;
}


/* Card Actions */
.card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding-right: var(--space-md);
  position: relative;
  z-index: 10;
}


/* ═══════════════════════════════════════════════════════════════
   Bucket Dropdown (on cards)
   ═══════════════════════════════════════════════════════════════ */

.bucket-dropdown {
  position: relative;
}

.bucket-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
}

.bucket-dropdown-btn:hover {
  border-color: var(--ink-faint);
  background: var(--cream-dark);
}

.bucket-icon {
  flex-shrink: 0;
}

.bucket-dropdown-text {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-arrow {
  flex-shrink: 0;
  transition: transform 0.15s;
}

.bucket-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--warm-white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 99999;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.bucket-dropdown-menu.open {
  display: block;
}

.bucket-option {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.1s;
}

.bucket-option:hover {
  background: var(--cream);
}

.bucket-option.selected {
  background: var(--terracotta-glow);
  color: var(--terracotta);
  font-weight: 500;
}

.bucket-option-new {
  border-top: 1px solid var(--cream-dark);
  color: var(--terracotta);
  font-weight: 500;
}

.bucket-option-new:hover {
  background: var(--terracotta-glow);
}


/* Delete Button */
.delete-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  opacity: 0;
  flex-shrink: 0;
}

.link-card:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  transform: scale(1.1);
}

.delete-btn:active {
  transform: scale(0.95);
}


/* ═══════════════════════════════════════════════════════════════
   Mobile Adjustments
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .main-container {
    padding: var(--space-md);
  }

  header {
    padding: var(--space-sm) 0 var(--space-lg);
    margin-bottom: var(--space-md);
  }

  header h1 {
    font-size: 1.5rem;
  }

  /* Hide sidebar on mobile */
  .bucket-sidebar {
    display: none;
  }

  /* Show mobile filter */
  .mobile-filter-bar {
    display: block;
  }

  .app-layout {
    flex-direction: column;
  }

  #add-link-form {
    flex-direction: column;
  }

  #add-btn {
    width: 100%;
  }

  .card-link {
    grid-template-columns: 70px 1fr;
  }

  .card-date {
    display: none;
  }

  .card-image {
    width: 70px;
    height: 50px;
  }

  .card-actions {
    flex-direction: column;
    gap: 4px;
    padding-right: var(--space-sm);
  }

  .bucket-dropdown-btn {
    padding: 4px 8px;
  }

  .bucket-dropdown-text {
    display: none;
  }

  .delete-btn {
    opacity: 1;
    width: 32px;
    height: 32px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   Accessibility & Focus States
   ═══════════════════════════════════════════════════════════════ */

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

/* Remove outline on mouse users */
:focus:not(:focus-visible) {
  outline: none;
}


/* ═══════════════════════════════════════════════════════════════
   Selection
   ═══════════════════════════════════════════════════════════════ */

::selection {
  background: var(--terracotta-pale);
  color: var(--ink);
}


/* ═══════════════════════════════════════════════════════════════
   Scrollbar (Webkit)
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 5px;
  border: 2px solid var(--cream);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-muted);
}
