/* ============================================================
   FisioCheck — Cookie Consent Bar
   Minimal · Professional · GDPR/LOPD compliant
   Supports light + dark theme via CSS custom properties
   ============================================================ */

/* ── Container ── */
#fc-cookie-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  padding: 0;

  /* Glass-morphism base */
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);

  border-top: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, 0.06),
    0 -1px 4px rgba(0, 0, 0, 0.03);

  /* Slide-up animation */
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.34, 1.06, 0.64, 1);
  will-change: transform;
}

[data-bs-theme="dark"] #fc-cookie-bar {
  background: rgba(15, 23, 42, 0.97);
  border-top-color: rgba(51, 65, 85, 0.8);
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, 0.3),
    0 -1px 4px rgba(0, 0, 0, 0.15);
}

#fc-cookie-bar.fc-cb--visible {
  transform: translateY(0);
}

/* ── Inner layout ── */
.fc-cb-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  flex-wrap: wrap;
}

/* ── Left side: icon + text ── */
.fc-cb-left {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  flex: 1 1 auto;
  min-width: 0;
}

.fc-cb-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--p-primary-soft, rgba(59, 130, 246, 0.1));
  color: var(--p-primary, #3b82f6);
  margin-top: 1px;
}

.fc-cb-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.fc-cb-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--p-text, #1e293b);
  line-height: 1.3;
}

.fc-cb-desc {
  font-size: 0.75rem;
  color: var(--p-text-muted, #64748b);
  line-height: 1.5;
}

.fc-cb-link {
  color: var(--p-primary, #3b82f6);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}

.fc-cb-link:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* ── Action buttons ── */
.fc-cb-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.fc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.fc-btn:focus-visible {
  outline: 2px solid var(--p-primary, #3b82f6);
  outline-offset: 2px;
}

.fc-btn-primary {
  background: var(--p-primary, #3b82f6);
  color: #fff;
}

.fc-btn-primary:hover {
  background: var(--p-primary-dark, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.fc-btn-primary:active {
  transform: translateY(0);
}

.fc-btn-outline {
  background: transparent;
  border: 1.5px solid var(--p-border, #e2e8f0);
  color: var(--p-text-muted, #64748b);
}

.fc-btn-outline:hover {
  border-color: var(--p-text-muted, #64748b);
  color: var(--p-text, #1e293b);
  background: var(--p-surface-alt, #f1f5f9);
}

[data-bs-theme="dark"] .fc-btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
}

.fc-btn-ghost {
  background: transparent;
  color: var(--p-text-muted, #64748b);
  border: 1.5px solid transparent;
}

.fc-btn-ghost:hover {
  color: var(--p-primary, #3b82f6);
  background: var(--p-primary-soft, rgba(59, 130, 246, 0.08));
}

.fc-btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.7rem;
}

/* ── Expanded panel ── */
.fc-cb-panel {
  border-top: 1px solid var(--p-border, #e2e8f0);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}

.fc-cb-panel.fc-cb-panel--open {
  max-height: 400px;
}

/* Override hidden but let CSS animation work */
.fc-cb-panel:not([hidden]) {
  display: block !important;
}

.fc-cb-panel-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ── Toggle option row ── */
.fc-cb-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--p-surface-alt, #f8fafc);
  border: 1px solid var(--p-border, #e2e8f0);
}

[data-bs-theme="dark"] .fc-cb-option {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--p-border, #334155);
}

.fc-cb-option-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.fc-cb-option-name {
  font-size: 0.7875rem;
  font-weight: 600;
  color: var(--p-text, #1e293b);
}

.fc-cb-option-desc {
  font-size: 0.7rem;
  color: var(--p-text-muted, #64748b);
  line-height: 1.4;
}

/* ── Toggle switch ── */
.fc-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--p-border, #e2e8f0);
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.fc-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.fc-toggle-dot {
  position: absolute;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fc-toggle:has(.fc-toggle-input:checked) {
  background: var(--p-primary, #3b82f6);
}

.fc-toggle:has(.fc-toggle-input:checked) .fc-toggle-dot {
  left: 19px;
}

/* Fallback for browsers without :has() */
.fc-toggle-input:checked ~ .fc-toggle-dot {
  left: 19px;
}

.fc-toggle--locked {
  background: var(--p-success, #10b981);
  cursor: default;
  pointer-events: none;
}

.fc-toggle--locked .fc-toggle-dot {
  left: 19px;
}

/* ── Panel footer ── */
.fc-cb-panel-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.25rem;
}

/* ── Responsive: mobile ── */
@media (max-width: 640px) {
  .fc-cb-inner {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .fc-cb-icon {
    display: none;
  }

  .fc-cb-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .fc-btn-ghost {
    display: none; /* hide "Personalizar" inline; shown below as full expand */
  }

  .fc-cb-panel-inner {
    padding: 0.75rem 1rem;
  }

  .fc-cb-option {
    padding: 0.5rem 0.625rem;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .fc-btn {
    padding: 0.375rem 0.6rem;
    font-size: 0.7rem;
  }
}
