/* CopyBoss Cookie Consent System - Floating Card Design */
/* Dark, glassy UI matching CopyBoss brand with right-slide animations */

/* Banner Styles - Floating Card */
.cb-consent-banner {
  position: fixed;
  bottom: clamp(12px, env(safe-area-inset-bottom) + 12px, 28px);
  right: 16px;
  z-index: 9999;
  width: min(420px, calc(100% - 32px));
  max-width: 420px;
  background: rgba(11, 15, 26, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  padding: 18px 18px 16px;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 240ms ease, transform 240ms ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cb-consent-banner.show {
  opacity: 1;
  transform: translateX(0);
}

.cb-consent-banner.cb-consent--closing {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 200ms ease, transform 200ms ease;
}

/* Close Button */
.cb-consent-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: rgba(229, 231, 235, 0.6);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  z-index: 1;
}

.cb-consent-close:hover {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.05);
}

.cb-consent-close:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Content */
.cb-consent-content {
  padding-right: 8px; /* Space for close button */
}

.cb-consent-text {
  margin-bottom: 16px;
}

.cb-consent-text h3 {
  color: #e5e7eb;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 8px 0;
}

.cb-consent-text p {
  color: rgba(229, 231, 235, 0.8);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 12px 0;
}

.cb-consent-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.cb-consent-links a {
  color: #9cc4ff;
  text-decoration: none;
  transition: color 200ms ease;
}

.cb-consent-links a:hover {
  color: #60a5fa;
  text-decoration: underline;
}

.cb-consent-links span {
  color: rgba(229, 231, 235, 0.4);
}

/* Actions */
.cb-consent-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-consent-btn {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.cb-consent-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Primary Button (Accept all) */
.cb-consent-btn-primary {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.cb-consent-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

/* Secondary Button (Reject non-essential) */
.cb-consent-btn-secondary {
  background: #0f172a;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.cb-consent-btn-secondary:hover {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Ghost Button (Customize) */
.cb-consent-btn-ghost {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cb-consent-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
}

/* Modal Styles */
.cb-consent-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.cb-consent-modal.show {
  opacity: 1;
  visibility: visible;
}

.cb-consent-modal-content {
  background: rgba(11, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 220ms ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.cb-consent-modal.show .cb-consent-modal-content {
  transform: scale(1);
}

.cb-consent-modal-header {
  margin-bottom: 24px;
}

.cb-consent-modal-title {
  color: #e5e7eb;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.cb-consent-modal-description {
  color: rgba(229, 231, 235, 0.8);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.cb-consent-preferences {
  margin-bottom: 32px;
}

.cb-consent-preference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cb-consent-preference:last-child {
  border-bottom: none;
}

.cb-consent-preference-info {
  flex: 1;
}

.cb-consent-preference-title {
  color: #e5e7eb;
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 4px 0;
}

.cb-consent-preference-description {
  color: rgba(229, 231, 235, 0.8);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.cb-consent-toggle {
  position: relative;
  width: 48px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 200ms ease;
  flex-shrink: 0;
}

.cb-consent-toggle.active {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.cb-consent-toggle.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cb-consent-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 200ms ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cb-consent-toggle.active::after {
  transform: translateX(24px);
}

.cb-consent-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.cb-consent-modal-btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 200ms ease;
  min-width: 100px;
}

.cb-consent-modal-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.cb-consent-modal-btn-primary {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.cb-consent-modal-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.cb-consent-modal-btn-secondary {
  background: transparent;
  color: rgba(229, 231, 235, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.cb-consent-modal-btn-secondary:hover {
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsive */
@media (max-width: 520px) {
  .cb-consent-banner {
    right: 16px;
    left: 16px;
    width: calc(100% - 32px);
    max-width: none;
    bottom: clamp(16px, env(safe-area-inset-bottom) + 16px, 32px);
  }
  
  .cb-consent-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .cb-consent-btn {
    width: 100%;
    flex: none;
  }
  
  .cb-consent-modal {
    padding: 16px;
  }
  
  .cb-consent-modal-content {
    padding: 24px;
    border-radius: 16px;
  }
  
  .cb-consent-modal-actions {
    flex-direction: column;
  }
  
  .cb-consent-modal-btn {
    width: 100%;
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .cb-consent-banner {
    padding: 16px 16px 14px;
  }
  
  .cb-consent-text h3 {
    font-size: 17px;
  }
  
  .cb-consent-text p {
    font-size: 14px;
  }
  
  .cb-consent-btn {
    font-size: 13px;
    padding: 10px 14px;
  }
  
  .cb-consent-modal-content {
    padding: 20px;
  }
  
  .cb-consent-modal-title {
    font-size: 18px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .cb-consent-banner {
    transition: opacity 240ms ease;
    transform: none !important;
  }
  
  .cb-consent-banner.show {
    transform: none !important;
  }
  
  .cb-consent-banner.cb-consent--closing {
    transform: none !important;
  }
  
  .cb-consent-modal-content {
    transition: none;
  }
  
  .cb-consent-modal.show .cb-consent-modal-content {
    transform: none;
  }
}

/* Animation Keyframes */
@keyframes cb-enter {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cb-exit {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* Desktop-only grid layout to prevent button overflow */
@media (min-width: 768px) {
  .cb-consent-banner {
    max-width: 420px;   /* a bit wider on desktop for breathing room */
  }
  
  .cb-consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "accept accept"
      "reject prefs";
    column-gap: 12px;
    row-gap: 10px;
    margin-top: 12px;
  }
  
  .cb-consent-btn {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
    white-space: normal;      /* allow wrapping instead of overflow */
    word-break: break-word;   /* keep long labels contained */
    line-height: 1.2;
  }
  
  .cb-consent-btn-primary { grid-area: accept; }
  .cb-consent-btn-secondary { grid-area: reject; }
  .cb-consent-btn-ghost { grid-area: prefs; }
}

/* Utility Classes */
.cb-consent-hidden {
  display: none !important;
}

.cb-consent-no-scroll {
  overflow: hidden;
}