/* ============================================================================
   bloo-cookie-banner.css
   Cookie consent banner & modal system for bloo.Cards SaaS
   BEM naming convention with 'bloo-' prefix
   ========================================================================== */

/* ============================================================================
   COOKIE BANNER (Bottom Fixed)
   ========================================================================== */

.bloo-cookie-banner {
  position: fixed;
  bottom: -200px;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #ffffff;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
  padding: 20px;
  transition: bottom 300ms cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid #e8e8e8;
}

.bloo-cookie-banner--visible {
  bottom: 0;
}

.bloo-cookie-banner__container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  justify-content: space-between;
}

.bloo-cookie-banner__content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.bloo-cookie-banner__icon {
  flex-shrink: 0;
  font-size: 32px;
  color: #6366f1;
  margin-top: 2px;
}

.bloo-cookie-banner__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bloo-cookie-banner__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #1a1a1a;
}

.bloo-cookie-banner__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #666666;
}

.bloo-cookie-banner__link {
  color: #6366f1;
  text-decoration: underline;
  font-weight: 500;
  transition: color 150ms ease-out;
  cursor: pointer;
}

.bloo-cookie-banner__link:hover {
  color: #4f46e5;
}

.bloo-cookie-banner__link:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.bloo-cookie-banner__actions {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

/* ============================================================================
   BUTTON VARIANTS (Shared with main design system)
   ========================================================================== */

.bloo-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease-out;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bloo-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.bloo-btn--primary {
  background-color: #6366f1;
  color: #ffffff;
}

.bloo-btn--primary:hover {
  background-color: #4f46e5;
}

.bloo-btn--primary:active {
  background-color: #4338ca;
}

.bloo-btn--outline {
  background-color: transparent;
  color: #6366f1;
  border: 1px solid #6366f1;
}

.bloo-btn--outline:hover {
  background-color: #f0f0fe;
}

.bloo-btn--outline:active {
  background-color: #e8e8fd;
}

.bloo-btn--ghost {
  background-color: transparent;
  color: #666666;
  border: 1px solid #e8e8e8;
}

.bloo-btn--ghost:hover {
  background-color: #f5f5f5;
  border-color: #d3d3d3;
}

.bloo-btn--ghost:active {
  background-color: #ebebeb;
}

.bloo-btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ============================================================================
   MODAL OVERLAY & CONTAINER
   ========================================================================== */

.bloo-cookie-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease-out;
}

.bloo-cookie-modal--visible {
  opacity: 1;
  pointer-events: auto;
}

.bloo-cookie-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.bloo-cookie-modal__dialog {
  position: relative;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bloo-modal-slide 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bloo-modal-slide {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ============================================================================
   MODAL HEADER
   ========================================================================== */

.bloo-cookie-modal__header {
  padding: 24px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bloo-cookie-modal__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1a1a;
}

.bloo-cookie-modal__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background-color: transparent;
  color: #666666;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease-out;
}

.bloo-cookie-modal__close:hover {
  background-color: #f5f5f5;
  color: #1a1a1a;
}

.bloo-cookie-modal__close:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 0px;
}

/* ============================================================================
   MODAL BODY & CONTENT
   ========================================================================== */

.bloo-cookie-modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.bloo-cookie-modal__intro {
  margin: 0 0 24px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #666666;
}

/* ============================================================================
   COOKIE CATEGORY BLOCKS
   ========================================================================== */

.bloo-cookie-modal__category {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 16px;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.bloo-cookie-modal__category:hover {
  border-color: #d3d3d3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bloo-cookie-modal__category-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.bloo-cookie-modal__category-info {
  flex: 1;
}

.bloo-cookie-modal__category-info h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.bloo-cookie-modal__category-info p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #999999;
}

.bloo-cookie-modal__category-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.bloo-cookie-modal__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.bloo-cookie-modal__badge--required {
  background-color: #d1fae5;
  color: #065f46;
}

/* ============================================================================
   TOGGLE SWITCH (Custom CSS)
   ========================================================================== */

.bloo-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.bloo-toggle input {
  display: none;
}

.bloo-toggle__slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  background-color: #cccccc;
  border-radius: 11px;
  transition: background-color 200ms ease-out;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.bloo-toggle__slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background-color: #ffffff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 200ms ease-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bloo-toggle input:checked + .bloo-toggle__slider {
  background-color: #10b981;
}

.bloo-toggle input:checked + .bloo-toggle__slider::after {
  left: 20px;
}

.bloo-toggle input:focus-visible + .bloo-toggle__slider {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.bloo-toggle--disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.bloo-toggle--disabled input {
  cursor: not-allowed;
}

/* ============================================================================
   DETAILS TOGGLE & TABLE
   ========================================================================== */

.bloo-cookie-modal__details-toggle {
  background: none;
  border: none;
  color: #6366f1;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 150ms ease-out;
}

.bloo-cookie-modal__details-toggle:hover {
  color: #4f46e5;
}

.bloo-cookie-modal__details-toggle:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.bloo-cookie-modal__details-toggle::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 11px;
  transition: transform 200ms ease-out;
}

.bloo-cookie-modal__details-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.bloo-cookie-modal__details {
  margin-top: 12px;
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}

.bloo-cookie-modal__details[hidden] {
  display: none;
}

.bloo-cookie-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bloo-cookie-modal__table thead {
  background-color: #f9f9f9;
}

.bloo-cookie-modal__table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: #1a1a1a;
  border-bottom: 1px solid #e8e8e8;
}

.bloo-cookie-modal__table td {
  padding: 8px 12px;
  color: #666666;
  border-bottom: 1px solid #f0f0f0;
}

.bloo-cookie-modal__table code {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #e83e8c;
}

/* ============================================================================
   NO-ADS MESSAGE
   ========================================================================== */

.bloo-cookie-modal__no-ads {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 20px;
  font-size: 13px;
  color: #065f46;
  line-height: 1.4;
}

.bloo-cookie-modal__no-ads i {
  flex-shrink: 0;
  font-size: 16px;
}

.bloo-cookie-modal__no-ads p {
  margin: 0;
}

/* ============================================================================
   MODAL FOOTER
   ========================================================================== */

.bloo-cookie-modal__footer {
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: #fafafa;
}

/* ============================================================================
   DARK MODE SUPPORT
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  .bloo-cookie-banner {
    background: #1e1e1e;
    border-top-color: #333333;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5);
  }

  .bloo-cookie-banner__title {
    color: #ffffff;
  }

  .bloo-cookie-banner__desc {
    color: #b3b3b3;
  }

  .bloo-cookie-banner__link {
    color: #a5f3fc;
  }

  .bloo-cookie-banner__link:hover {
    color: #67e8f9;
  }

  .bloo-btn--primary {
    background-color: #6366f1;
    color: #ffffff;
  }

  .bloo-btn--primary:hover {
    background-color: #818cf8;
  }

  .bloo-btn--outline {
    color: #a5f3fc;
    border-color: #a5f3fc;
  }

  .bloo-btn--outline:hover {
    background-color: rgba(165, 243, 252, 0.1);
  }

  .bloo-btn--ghost {
    color: #b3b3b3;
    border-color: #404040;
  }

  .bloo-btn--ghost:hover {
    background-color: #2a2a2a;
    border-color: #555555;
  }

  .bloo-cookie-modal__dialog {
    background-color: #1e1e1e;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  }

  .bloo-cookie-modal__header {
    border-bottom-color: #333333;
  }

  .bloo-cookie-modal__title {
    color: #ffffff;
  }

  .bloo-cookie-modal__close {
    color: #b3b3b3;
  }

  .bloo-cookie-modal__close:hover {
    background-color: #333333;
    color: #ffffff;
  }

  .bloo-cookie-modal__intro {
    color: #b3b3b3;
  }

  .bloo-cookie-modal__category {
    border-color: #333333;
    background-color: #2a2a2a;
  }

  .bloo-cookie-modal__category:hover {
    border-color: #404040;
  }

  .bloo-cookie-modal__category-info h3 {
    color: #ffffff;
  }

  .bloo-cookie-modal__category-info p {
    color: #999999;
  }

  .bloo-cookie-modal__badge--required {
    background-color: rgba(16, 185, 129, 0.2);
    color: #86efac;
  }

  .bloo-toggle__slider {
    background-color: #404040;
  }

  .bloo-toggle__slider::after {
    background-color: #2a2a2a;
  }

  .bloo-toggle input:checked + .bloo-toggle__slider {
    background-color: #10b981;
  }

  .bloo-cookie-modal__details-toggle {
    color: #a5f3fc;
  }

  .bloo-cookie-modal__details-toggle:hover {
    color: #67e8f9;
  }

  .bloo-cookie-modal__details {
    border-top-color: #333333;
  }

  .bloo-cookie-modal__table thead {
    background-color: #2a2a2a;
  }

  .bloo-cookie-modal__table th {
    color: #ffffff;
    border-bottom-color: #333333;
  }

  .bloo-cookie-modal__table td {
    color: #b3b3b3;
    border-bottom-color: #2a2a2a;
  }

  .bloo-cookie-modal__table code {
    background-color: #333333;
    color: #f472b6;
  }

  .bloo-cookie-modal__no-ads {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #86efac;
  }

  .bloo-cookie-modal__footer {
    border-top-color: #333333;
    background-color: #2a2a2a;
  }
}

/* ============================================================================
   RESPONSIVE DESIGN (Mobile)
   ========================================================================== */

@media (max-width: 768px) {
  .bloo-cookie-banner__container {
    flex-direction: column;
    gap: 16px;
  }

  .bloo-cookie-banner__content {
    width: 100%;
  }

  .bloo-cookie-banner__actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .bloo-cookie-banner__actions .bloo-btn {
    width: 100%;
  }

  .bloo-cookie-modal__dialog {
    width: 95%;
    max-height: 90vh;
  }

  .bloo-cookie-modal__header {
    padding: 16px;
  }

  .bloo-cookie-modal__body {
    padding: 16px;
  }

  .bloo-cookie-modal__footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
  }

  .bloo-cookie-modal__footer .bloo-btn {
    width: 100%;
  }

  .bloo-cookie-modal__category {
    padding: 12px;
    margin-bottom: 12px;
  }

  .bloo-cookie-modal__category-header {
    flex-direction: column;
    gap: 12px;
  }

  .bloo-cookie-modal__category-controls {
    width: 100%;
    justify-content: space-between;
  }

  .bloo-cookie-modal__table {
    font-size: 12px;
  }

  .bloo-cookie-modal__table th,
  .bloo-cookie-modal__table td {
    padding: 6px 8px;
  }
}

/* ============================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  .bloo-cookie-banner,
  .bloo-cookie-modal {
    display: none !important;
  }
}

/* ============================================================================
   FOCUS MANAGEMENT & ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .bloo-cookie-banner,
  .bloo-btn,
  .bloo-toggle__slider,
  .bloo-toggle__slider::after,
  .bloo-cookie-modal__details-toggle::after,
  .bloo-cookie-modal__dialog {
    transition: none !important;
    animation: none !important;
  }
}

/* Ensure sufficient color contrast */
.bloo-cookie-banner__link {
  color: #4f46e5;
}

@media (prefers-contrast: more) {
  .bloo-cookie-banner__desc {
    font-weight: 500;
  }

  .bloo-cookie-modal__category-info p {
    font-weight: 500;
  }

  .bloo-cookie-modal__intro {
    font-weight: 500;
  }
}
