/* Content Cards */
.content-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  border-left: 3px solid transparent;
}

.content-card:active {
  cursor: grabbing;
}

.content-card:hover {
  box-shadow: var(--shadow-sm);
}

.content-card.sortable-ghost {
  opacity: 0.4;
}

.content-card.sortable-chosen {
  box-shadow: var(--shadow-md);
  transform: scale(1.02);
}

.content-card .card-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content-card .card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
}

.status-badge.to-film {
  background: var(--status-to-film);
}

.status-badge.filmed {
  background: var(--status-filmed);
}

.status-badge.edited {
  background: var(--status-edited);
}

.status-badge.ready {
  background: var(--status-ready);
}

.status-badge.posted {
  background: var(--status-posted);
}

/* Tag Pills */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 74, 0.3);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(8px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-size: 1.1rem;
}

.modal-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.form-input {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  transition: border-color 0.15s;
}

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

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237A7A7A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

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

/* Buttons */
.btn {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

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

.btn-primary:hover {
  background: #7A8E7A;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
}

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

.btn-danger {
  color: #C0706B;
}

.btn-danger:hover {
  background: #FFF0EE;
}

/* Tag multi-select */
.tag-select {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tag-select .tag-option {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
}

.tag-select .tag-option.selected {
  border-color: currentColor;
}

/* Color picker preset */
.color-presets {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.color-preset:hover {
  transform: scale(1.1);
}

.color-preset.selected {
  border-color: var(--text);
}

/* Settings drawer */
.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 90vw;
  background: white;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.settings-drawer.open {
  transform: translateX(0);
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 74, 0.2);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.settings-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.settings-section {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.settings-section h3 {
  margin-bottom: var(--space-md);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
}

/* Checkbox toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
}

.toggle-row label {
  font-size: 14px;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

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

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 11px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .slider {
  background: var(--accent);
}

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

/* Auth screen */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-lg);
}

.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.auth-card h1 {
  margin-bottom: var(--space-xs);
}

.auth-card p {
  color: var(--text-light);
  margin-bottom: var(--space-lg);
}

.auth-card .form-input {
  width: 100%;
  margin-bottom: var(--space-md);
}

.auth-card .btn {
  width: 100%;
}

.auth-message {
  margin-top: var(--space-md);
  font-size: 13px;
  color: var(--accent);
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--text);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(253, 248, 246, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius-lg);
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   Ideas Panel
   Desktop: right-docked rail. Mobile: bottom sheet.
   (Mobile overrides live in responsive.css.)
   Z-index layers used here:
     1001 → .ideas-backdrop (matches settings backdrop tier)
     1002 → .ideas-panel   (above settings drawer at 1001)
   ───────────────────────────────────────────── */

/* Utility (add here in case it isn't defined globally) */
.hidden {
  display: none !important;
}

/* Mobile-only dim backdrop — hidden by default, disabled on desktop */
.ideas-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 74, 0.35);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: none; /* not shown on desktop */
}

/* The panel — right-docked rail on desktop */
.ideas-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(340px, 85vw);
  background: white;
  box-shadow: var(--shadow-lg);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden; /* inner list scrolls, not the whole panel */
  padding-bottom: env(safe-area-inset-bottom);
}

body.ideas-open .ideas-panel {
  transform: none;
}

/* Push the main content aside on desktop so the calendar stays usable */
body.ideas-open .app-header,
body.ideas-open #calendar {
  transition: margin-right 0.25s ease;
}

/* Panel header */
.ideas-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.ideas-panel-header h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}

/* Quick-add form */
.idea-quickadd {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.idea-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
}

.idea-add-btn {
  flex: 0 0 auto;
  min-height: 44px;
}

/* Active ideas list — vertical stack, scrolls internally */
.ideas-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}

/* Idea card — content-card look, but a horizontal row */
.idea-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  border-left: 3px solid transparent;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
}

.idea-card:hover {
  box-shadow: var(--shadow-sm);
}

.idea-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.idea-card:active {
  cursor: grabbing;
}

/* Round checkbox-style button */
.idea-check {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

/* Enlarge the tap target without changing the visual size */
.idea-check::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.idea-check:hover {
  border-color: #7A8E7A;
  background: rgba(139, 158, 139, 0.12);
}

/* Checked / done tick state */
.idea-check.checked,
.idea-card.done .idea-check {
  background: var(--accent);
  border-color: var(--accent);
}

.idea-check.checked::before,
.idea-card.done .idea-check::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Idea body — title + optional meta */
.idea-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
  flex: 1 1 auto;
}

.idea-title {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Done cards — dimmed, struck through, delete on the right */
.idea-card.done {
  background: transparent;
  cursor: default;
  align-items: center;
}

.idea-card.done .idea-title {
  color: var(--text-light);
  text-decoration: line-through;
}

.idea-delete {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.idea-delete:hover {
  background: #FFF0EE;
  color: #C0706B;
}

/* Empty state helper text */
.ideas-empty {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.5;
}

/* Show empty message automatically when the list has no children
   (JS may also toggle it, but this is a graceful fallback). */
.ideas-list:empty + .ideas-empty {
  display: block;
}

/* Done section toggle — full-width subtle text button */
.ideas-done-toggle {
  flex-shrink: 0;
  width: 100%;
  padding: var(--space-sm) var(--space-lg);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-top: 1px solid var(--border-light);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.ideas-done-toggle:hover {
  color: var(--text);
  background: var(--card);
}

/* Done list */
.ideas-done-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg) var(--space-md);
  overflow-y: auto;
  flex-shrink: 0;
  max-height: 30vh;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .ideas-panel,
  .ideas-backdrop,
  body.ideas-open .app-header,
  body.ideas-open #calendar {
    transition: none;
  }
}

/* ─── Ideas drag: lifted clone that follows the finger/cursor (forceFallback) ─── */
/* NOTE: never set `transform` here — SortableJS uses it to position the clone. */
.idea-drag-fallback {
  opacity: 0.96 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22) !important;
  z-index: 3000 !important;
}

/* Small helper text under a form field */
.form-hint {
  font-size: 12px;
  color: var(--text-light);
}

/* "Move back to Ideas" in the content editor */
.btn-unschedule {
  align-self: flex-start;
  margin-top: var(--space-xs);
}

/* Login: code entry + error message */
.auth-code-form {
  margin-top: var(--space-md);
}

.auth-code-input {
  text-align: center;
  letter-spacing: 4px;
  font-size: 18px;
}

.auth-message.error {
  color: #C0706B;
}

/* Toast with a tappable action (e.g. Undo) */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: opacity 0.2s;
}

.toast-action {
  color: white;
  font-weight: 700;
  text-decoration: underline;
  padding: var(--space-xs) 0;
}

/* Login screen extras */
.auth-logo {
  display: block;
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-md);
}

.auth-card .btn-google {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 10px var(--space-md);
  font-size: 14px;
  gap: var(--space-sm);
}

.auth-card .btn-google:hover {
  background: var(--bg);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  font-size: 12px;
  color: var(--text-light);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.auth-captcha:not(:empty) {
  margin-bottom: var(--space-md);
}

.auth-card .auth-legal {
  margin: var(--space-lg) 0 0;
  font-size: 12px;
}

.auth-legal a,
.account-links a {
  color: var(--text-light);
  text-decoration: underline;
}

/* Settings: account section */
.account-links {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: 13px;
}

.delete-account-btn {
  margin-top: var(--space-sm);
}

.btn-danger-solid {
  background: #C0706B;
  color: white;
}

.btn-danger-solid:hover {
  background: #A85E59;
}

/* Confirm dialog sits above everything else */
.confirm-overlay {
  z-index: 1100;
}

/* Welcome screen */
.welcome-modal .modal-header {
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.welcome-dots {
  display: flex;
  gap: 6px;
}

.welcome-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.welcome-dots span.active {
  background: var(--accent);
}

.welcome-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.welcome-list li {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.welcome-icon {
  font-size: 20px;
  line-height: 1.2;
}

.welcome-install {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.welcome-steps {
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.welcome-hint {
  font-size: 12px;
  color: var(--text-light);
}

.welcome-install-btn {
  align-self: flex-start;
}

.inline-icon {
  vertical-align: -3px;
}

.welcome-tags {
  margin-top: var(--space-md);
}

.welcome-tags .tag-option {
  font-size: 13px;
  padding: 6px 12px;
}

/* Disabled buttons look disabled */
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
