/* ==========================================================================
   StaySaver — Cookie Consent (banner + preferences modal)
   Loaded by app/templates/partials/cookie-consent.html

   Conventions
   - BEM-style names already in use: .ssc-block, .ssc-block__el, .ssc-x--mod
     (kept as-is for backward compatibility with the markup/JS).
   - Colors use the shared navy tokens (--ss-navy*) defined in custom.css;
     literal fallbacks are provided so the file degrades gracefully alone.
   - Property order: position → box model → typography → visual → motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Banner
   -------------------------------------------------------------------------- */
.ssc-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99990;
  display: none;
  padding: 18px 0 calc(18px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 3px solid var(--ss-navy, #1e3a5f);
  box-shadow: 0 -6px 28px rgba(0, 0, 0, .14);
}
.ssc-banner.ssc-show {
  display: block;
  animation: sscUp .35s ease;
}

.ssc-banner-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}

.ssc-banner-text {
  flex: 1 1 420px;
  min-width: 280px;
}
.ssc-banner-text h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #1f2a2c;
}
.ssc-banner-text h4 i {
  font-size: 19px;
  color: var(--ss-navy, #1e3a5f);
}
.ssc-banner-text p {
  margin: 0;
  font-size: 13.5px;
  color: #5a6568;
  line-height: 1.65;
}
.ssc-banner-text a {
  color: var(--ss-navy, #1e3a5f);
  font-weight: 600;
  text-decoration: none;
}
.ssc-banner-text a:hover {
  text-decoration: underline;
}

.ssc-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Buttons  (primary = solid navy, ghost = navy outline, link = text)
   -------------------------------------------------------------------------- */
.ssc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 20px;
  border: 1.5px solid transparent;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, box-shadow .18s;
}
.ssc-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, .40);   /* navy focus ring (a11y) */
}

.ssc-btn--primary {
  background: linear-gradient(90deg, var(--ss-navy, #1e3a5f), var(--ss-navy-strong, #152944));
  color: #fff;
  border-color: transparent;
}
.ssc-btn--primary:hover {
  box-shadow: 0 6px 18px rgba(30, 58, 95, .32);
}

.ssc-btn--ghost {
  background: #fff;
  color: #1f2a2c;
  border-color: #d5dee0;
}
.ssc-btn--ghost:hover {
  border-color: var(--ss-navy, #1e3a5f);
  color: var(--ss-navy, #1e3a5f);
}

.ssc-btn--link {
  padding: 11px 8px;
  background: transparent;
  color: #5a6568;
  border-color: transparent;
  text-decoration: underline;
}
.ssc-btn--link:hover {
  color: var(--ss-navy, #1e3a5f);
}

/* --------------------------------------------------------------------------
   Preferences modal
   -------------------------------------------------------------------------- */
.ssc-overlay {
  position: fixed;
  inset: 0;
  z-index: 99995;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 30, 32, .55);
  backdrop-filter: blur(2px);
}
.ssc-overlay.ssc-show {
  display: flex;
  animation: sscFade .25s ease;
}

.ssc-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .30);
  animation: sscPop .3s cubic-bezier(.2, .8, .3, 1.2);
}

.ssc-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 26px 16px;
  border-bottom: 1.5px solid #e9eff6;
}
.ssc-modal-head h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2a2c;
}
.ssc-modal-head h3 i {
  font-size: 21px;
  color: var(--ss-navy, #1e3a5f);
}
.ssc-modal-head p {
  margin: 0;
  font-size: 13px;
  color: #7a8688;
  line-height: 1.55;
}

.ssc-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #f1f4f8;
  color: #5a6568;
  font-size: 18px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ssc-close:hover {
  background: #fde8e8;
  color: #d6422b;            /* semantic "dismiss" red — intentional */
}

.ssc-modal-body {
  padding: 8px 26px 4px;
  overflow-y: auto;
}

.ssc-modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding: 16px 26px 22px;
  border-top: 1.5px solid #e9eff6;
}

/* --------------------------------------------------------------------------
   Category row
   -------------------------------------------------------------------------- */
.ssc-cat {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1.5px solid #e9eff6;
  border-radius: 13px;
  transition: border-color .18s;
}
.ssc-cat:hover {
  border-color: var(--ss-navy-soft, #dde8f5);
}
.ssc-cat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ssc-cat-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: #1f2a2c;
}
.ssc-cat-name i {
  font-size: 16px;
  color: var(--ss-navy, #1e3a5f);
}
.ssc-cat p {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #6a7679;
  line-height: 1.6;
}

.ssc-locked {
  padding: 3px 10px;
  border-radius: 30px;
  background: var(--ss-navy-soft, #dde8f5);
  color: var(--ss-navy, #1e3a5f);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

/* --------------------------------------------------------------------------
   Toggle switch
   -------------------------------------------------------------------------- */
.ssc-switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
}
.ssc-switch input {
  width: 0;
  height: 0;
  opacity: 0;
}
.ssc-slider {
  position: absolute;
  inset: 0;
  background: #cdd7d9;
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.ssc-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.ssc-switch input:checked + .ssc-slider {
  background: linear-gradient(90deg, var(--ss-navy, #1e3a5f), var(--ss-navy-strong, #152944));
}
.ssc-switch input:checked + .ssc-slider::before {
  transform: translateX(18px);
}
.ssc-switch input:focus-visible + .ssc-slider {
  box-shadow: 0 0 0 3px rgba(30, 58, 95, .40);   /* navy focus ring (a11y) */
}
.ssc-switch input:disabled + .ssc-slider {
  opacity: .65;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */
@keyframes sscUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes sscFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sscPop {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* --------------------------------------------------------------------------
   Responsive  (largest → smallest)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .ssc-banner-inner { gap: 20px; }
}
@media (max-width: 991px) {
  .ssc-banner-inner { gap: 16px; }
}
@media (max-width: 768px) {
  .ssc-banner-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .ssc-actions { justify-content: stretch; }
  .ssc-actions .ssc-btn--primary,
  .ssc-actions .ssc-btn--ghost { flex: 1 1 auto; }
}
@media (max-width: 575px) {
  .ssc-banner { padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); }
  .ssc-actions { flex-direction: column; }
  .ssc-actions .ssc-btn { width: 100%; text-align: center; }
  .ssc-modal { max-width: 100%; border-radius: 16px; }
  .ssc-modal-foot { flex-direction: column-reverse; }
  .ssc-modal-foot .ssc-btn { width: 100%; }
}
@media (max-width: 480px) {
  .ssc-banner-text h4 { font-size: 15px; }
  .ssc-banner-text p  { font-size: 13px; }
  .ssc-modal-head { padding: 18px 18px 14px; }
  .ssc-modal-body { padding: 6px 18px 2px; }
  .ssc-modal-foot { padding: 14px 18px 18px; }
}
@media (max-width: 400px) {
  .ssc-btn { padding: 11px 14px; font-size: 13px; }
}
