/**
 * SAVED SEARCHES PAGE — CSS
 * =========================
 * Styles for /account#searches (saved searches list).
 * All classes prefixed `ss-` to avoid collisions.
 * Hosted on R2: ld/saved-searches.css
 */

/* ── Page Layout ── */
.ss-page {
  font-family: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #1a1a1a;
}

/* ── Header ── */
.ss-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 14px;
}
.ss-hdr-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ss-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f0f0f;
  margin: 0;
  line-height: 1.2;
}
.ss-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.ss-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #0f0f0f;
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.22,.68,0,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  white-space: nowrap;
}
.ss-add-btn:hover {
  background: #262626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.ss-add-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Search Cards List ── */
.ss-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Search Card ── */
.ss-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  padding: 20px 24px;
  transition: transform 0.25s cubic-bezier(.22,.68,0,1), box-shadow 0.25s cubic-bezier(.22,.68,0,1);
}
.ss-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
}

/* Card entrance animation */
@keyframes ss-card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ss-card {
  animation: ss-card-in 0.45s cubic-bezier(.22,.68,0,1) both;
}

/* Remove animation */
.ss-card.ss-removing {
  opacity: 0;
  transform: scale(0.95) translateY(8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(.22,.68,0,1);
}

/* ── Card Top Row ── */
.ss-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.ss-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f0f0f;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.ss-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ss-card-btn {
  padding: 6px 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  color: #9ca3af;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ss-card-btn:hover {
  background: #f3f4f6;
  color: #1a1a1a;
}
.ss-card-btn svg {
  width: 16px;
  height: 16px;
}
.ss-card-btn-edit:hover {
  background: #eff6ff;
  color: #2563eb;
}
.ss-card-btn-delete:hover {
  background: #fef2f2;
  color: #c8102e;
}

/* ── Criteria Pills ── */
.ss-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.ss-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 500;
  color: #4b5563;
  line-height: 1.4;
}
.ss-pill svg {
  width: 12px;
  height: 12px;
  color: #9ca3af;
}

/* ── Card Bottom Row ── */
.ss-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}
.ss-card-meta {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Alert toggle */
.ss-alert-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.ss-alert-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
}
.ss-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: #e5e7eb;
  border-radius: 10px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.ss-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform 0.2s cubic-bezier(.22,.68,0,1);
}
.ss-toggle.ss-on {
  background: #059669;
}
.ss-toggle.ss-on::after {
  transform: translateX(16px);
}

/* View Results button */
.ss-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.ss-view-btn:hover {
  border-color: #1a1a1a;
  transform: translateY(-1px);
}
.ss-view-btn svg {
  width: 13px;
  height: 13px;
}

/* ── Loading Skeletons ── */
.ss-skel {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.06);
  padding: 20px 24px;
}
.ss-skel-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(110deg, #f5f5f4 30%, #ebebea 50%, #f5f5f4 70%);
  background-size: 250% 100%;
  animation: ss-shimmer 1.8s ease-in-out infinite;
  margin-bottom: 10px;
}
.ss-skel-line:nth-child(1) { width: 40%; height: 16px; }
.ss-skel-line:nth-child(2) { width: 70%; animation-delay: 0.1s; }
.ss-skel-line:nth-child(3) { width: 50%; animation-delay: 0.2s; }

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

/* ── Empty / Login / Error States ── */
@keyframes ss-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ss-empty {
  text-align: center;
  padding: 64px 24px;
  animation: ss-fade-up 0.5s cubic-bezier(.22,.68,0,1) both;
}
.ss-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  color: #d1d5db;
  opacity: 0.7;
}
.ss-empty-icon svg {
  width: 100%;
  height: 100%;
}
.ss-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.ss-empty p {
  font-size: 0.88rem;
  color: #6b7280;
  margin: 0 0 28px;
  line-height: 1.6;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.ss-login {
  text-align: center;
  padding: 64px 24px;
  animation: ss-fade-up 0.5s cubic-bezier(.22,.68,0,1) both;
}
.ss-login-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  color: #d1d5db;
  opacity: 0.7;
}
.ss-login-icon svg { width: 100%; height: 100%; }
.ss-login h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
}
.ss-login p {
  font-size: 0.88rem;
  color: #6b7280;
  margin: 0 0 28px;
  line-height: 1.6;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.ss-login-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.ss-login-btn {
  padding: 12px 28px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.22,.68,0,1);
  text-decoration: none;
  border: none;
}
.ss-login-btn-primary {
  background: #c8102e;
  color: #fff;
  border: 1px solid #c8102e;
}
.ss-login-btn-primary:hover {
  background: #a30d25;
  transform: translateY(-1px);
}
.ss-login-btn-secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
}
.ss-login-btn-secondary:hover {
  border-color: #1a1a1a;
  transform: translateY(-1px);
}

.ss-error {
  text-align: center;
  padding: 64px 24px;
  animation: ss-fade-up 0.5s cubic-bezier(.22,.68,0,1) both;
}
.ss-error h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 8px;
}
.ss-error p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 20px;
}
.ss-error-btn {
  padding: 10px 24px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ss-error-btn:hover {
  border-color: #1a1a1a;
}

/* ── Edit Modal ── */
.ss-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ss-overlay-in 0.2s ease both;
}
@keyframes ss-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ss-edit-overlay.ss-edit-closing {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ss-edit-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.08);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: ss-modal-in 0.3s cubic-bezier(.22,.68,0,1) both;
  overflow: hidden;
}
@keyframes ss-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ss-edit-closing .ss-edit-modal {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: all 0.2s ease;
}
.ss-edit-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.ss-edit-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f0f0f;
  margin: 0;
  letter-spacing: -0.01em;
}
.ss-edit-close {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #9ca3af;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.ss-edit-close:hover {
  background: #f3f4f6;
  color: #1a1a1a;
}
.ss-edit-close svg {
  width: 18px;
  height: 18px;
}
.ss-edit-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.ss-edit-field {
  margin-bottom: 20px;
}
.ss-edit-field:last-child {
  margin-bottom: 0;
}
.ss-edit-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.ss-edit-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: #1a1a1a;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}
.ss-edit-input:focus {
  outline: none;
  border-color: #c8102e;
  box-shadow: 0 0 0 3px rgba(200,16,46,.08);
}
.ss-edit-input::placeholder {
  color: #9ca3af;
}
.ss-edit-readonly {
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 10px;
  font-size: 0.88rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ss-edit-readonly svg {
  width: 14px;
  height: 14px;
  color: #9ca3af;
}
.ss-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ss-edit-sep {
  color: #9ca3af;
  font-weight: 500;
  flex-shrink: 0;
}
.ss-edit-input-wrap {
  position: relative;
  flex: 1;
}
.ss-edit-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.88rem;
  pointer-events: none;
}
.ss-edit-input-wrap .ss-edit-input {
  padding-left: 28px;
}
.ss-edit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ss-edit-pill {
  padding: 7px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.ss-edit-pill:hover {
  border-color: #d1d5db;
  background: #f3f4f6;
}
.ss-edit-pill.ss-sel {
  background: #c8102e;
  border-color: #c8102e;
  color: #fff;
}
.ss-edit-pill.ss-sel:hover {
  background: #a30d25;
  border-color: #a30d25;
}
.ss-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.ss-edit-cancel {
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ss-edit-cancel:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
}
.ss-edit-save {
  padding: 10px 24px;
  background: #c8102e;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.22,.68,0,1);
}
.ss-edit-save:hover {
  background: #a30d25;
  transform: translateY(-1px);
}
.ss-edit-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .ss-list {
    width: 100%;
  }
  .ss-card {
    width: 100%;
  }
}
@media (max-width: 767px) {
  .ss-hdr {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .ss-card {
    padding: 16px 18px;
    border-radius: 12px;
  }
  .ss-card-top {
    flex-direction: column;
    gap: 8px;
  }
  .ss-card-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .ss-login-btns {
    flex-direction: column;
  }
  .ss-login-btn {
    width: 100%;
    text-align: center;
  }
  /* Edit modal → bottom sheet */
  .ss-edit-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .ss-edit-modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    animation: ss-sheet-in 0.3s cubic-bezier(.22,.68,0,1) both;
  }
  @keyframes ss-sheet-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .ss-edit-closing .ss-edit-modal {
    transform: translateY(100%);
  }
  .ss-edit-row {
    flex-direction: column;
    gap: 8px;
  }
  .ss-edit-sep {
    display: none;
  }
  .ss-edit-footer {
    flex-direction: column;
  }
  .ss-edit-cancel,
  .ss-edit-save {
    width: 100%;
    text-align: center;
  }
}
