/* ============================================================
   Intellectum Lab — Cookie Consent Widget
   GDPR / UK GDPR / ePrivacy / CCPA / LGPD compliant
   ============================================================ */

.ilc-root {
  --ilc-black: #000000;
  --ilc-white: #ffffff;
  --ilc-gray-100: #f8f8f8;
  --ilc-gray-200: #e8e8e8;
  --ilc-gray-300: #d8d8d8;
  --ilc-gray-400: #888888;
  --ilc-gray-500: #666666;
  --ilc-gray-600: #444444;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ilc-black);
  line-height: 1.5;
  font-size: 0.9375rem;
}

.ilc-root * {
  box-sizing: border-box;
}

/* ---------- Banner ---------- */
.ilc-banner {
  position: fixed;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  background: var(--ilc-white);
  border: 1px solid var(--ilc-gray-200);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 -4px 24px rgba(0, 0, 0, 0.04);
  padding: 1.5rem 1.75rem;
  z-index: 9998;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.ilc-banner.ilc-visible {
  transform: translateY(0);
  opacity: 1;
}

.ilc-banner-text h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.375rem 0;
  letter-spacing: -0.01em;
  color: var(--ilc-black);
}

.ilc-banner-text p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ilc-gray-500);
  line-height: 1.6;
}

.ilc-banner-text a {
  color: var(--ilc-black);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ilc-banner-text a:hover {
  color: var(--ilc-gray-600);
}

.ilc-banner-actions {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.ilc-btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.2;
}

.ilc-btn-primary {
  background: var(--ilc-black);
  color: var(--ilc-white);
  border-color: var(--ilc-black);
}

.ilc-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ilc-btn-secondary {
  background: var(--ilc-white);
  color: var(--ilc-black);
  border-color: var(--ilc-gray-300);
}

.ilc-btn-secondary:hover {
  border-color: var(--ilc-black);
  transform: translateY(-1px);
}

.ilc-btn-text {
  background: transparent;
  color: var(--ilc-gray-600);
  border: none;
  padding: 0.625rem 0.5rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ilc-gray-300);
}

.ilc-btn-text:hover {
  color: var(--ilc-black);
  text-decoration-color: var(--ilc-black);
}

/* ---------- Modal ---------- */
.ilc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
}

.ilc-backdrop.ilc-visible {
  opacity: 1;
}

.ilc-modal {
  background: var(--ilc-white);
  border: 1px solid var(--ilc-gray-200);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ilc-backdrop.ilc-visible .ilc-modal {
  transform: translateY(0) scale(1);
}

.ilc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--ilc-gray-200);
  flex-shrink: 0;
}

.ilc-modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ilc-black);
}

.ilc-modal-close {
  background: none;
  border: none;
  color: var(--ilc-gray-400);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.5rem;
  line-height: 1;
  transition: color 0.2s ease;
}

.ilc-modal-close:hover {
  color: var(--ilc-black);
}

.ilc-modal-body {
  padding: 1rem 1.75rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.ilc-modal-intro {
  font-size: 0.875rem;
  color: var(--ilc-gray-500);
  margin: 0 0 1.25rem 0;
  line-height: 1.6;
}

.ilc-modal-intro a {
  color: var(--ilc-black);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Category cards ---------- */
.ilc-category {
  border: 1px solid var(--ilc-gray-200);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: var(--ilc-white);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.ilc-category:hover {
  border-color: var(--ilc-gray-300);
}

.ilc-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.125rem;
  cursor: pointer;
  user-select: none;
  gap: 1rem;
}

.ilc-category-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  min-width: 0;
}

.ilc-category-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ilc-gray-400);
  transition: transform 0.2s ease;
}

.ilc-category.ilc-open .ilc-category-chevron {
  transform: rotate(90deg);
}

.ilc-category-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--ilc-black);
}

.ilc-category-status {
  font-size: 0.75rem;
  color: var(--ilc-gray-400);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ilc-category-body {
  display: none;
  padding: 0 1.125rem 1.125rem;
  border-top: 1px solid var(--ilc-gray-200);
  margin-top: -1px;
}

.ilc-category.ilc-open .ilc-category-body {
  display: block;
}

.ilc-category-desc {
  font-size: 0.8125rem;
  color: var(--ilc-gray-500);
  line-height: 1.6;
  margin: 0.875rem 0 0.75rem 0;
}

.ilc-cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.ilc-cookie-table th,
.ilc-cookie-table td {
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--ilc-gray-200);
  vertical-align: top;
}

.ilc-cookie-table th {
  font-weight: 600;
  color: var(--ilc-gray-600);
  background: var(--ilc-gray-100);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
}

.ilc-cookie-table td {
  color: var(--ilc-gray-500);
}

.ilc-cookie-table tr:last-child td {
  border-bottom: none;
}

/* ---------- Toggle switch ---------- */
.ilc-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.ilc-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ilc-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--ilc-gray-300);
  border-radius: 22px;
  transition: background 0.2s ease;
}

.ilc-toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: var(--ilc-white);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.ilc-toggle input:checked + .ilc-toggle-slider {
  background: var(--ilc-black);
}

.ilc-toggle input:checked + .ilc-toggle-slider::before {
  transform: translateX(16px);
}

.ilc-toggle input:disabled + .ilc-toggle-slider {
  background: var(--ilc-black);
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Modal footer ---------- */
.ilc-modal-footer {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--ilc-gray-200);
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--ilc-gray-100);
}

/* ---------- Footer link ---------- */
.cookie-prefs-link {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: currentColor;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.cookie-prefs-link:hover {
  opacity: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .ilc-banner {
    grid-template-columns: 1fr;
    gap: 1.125rem;
    padding: 1.25rem 1.25rem 1.375rem;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .ilc-banner-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.5rem;
  }

  .ilc-banner-actions .ilc-btn {
    width: 100%;
    text-align: center;
  }

  .ilc-modal-header,
  .ilc-modal-body,
  .ilc-modal-footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .ilc-modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .ilc-modal-footer .ilc-btn {
    width: 100%;
    text-align: center;
  }

  .ilc-modal-header h2 {
    font-size: 1.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ilc-banner,
  .ilc-backdrop,
  .ilc-modal,
  .ilc-toggle-slider,
  .ilc-toggle-slider::before,
  .ilc-category-chevron {
    transition: none;
  }
}
