/**
 * die.app – Cookie Banner Styles
 * Prefix: .cb- (Cookie Banner)
 */

/* ─── Reset & Variables ────────────────────────────────── */
.cb-root,
.cb-root *,
.cb-root *::before,
.cb-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.cb-root {
  --cb-bg: #ffffff;
  --cb-text: #1a1a2e;
  --cb-muted: #64748b;
  --cb-light: #94a3b8;
  --cb-border: #e2e8f0;
  --cb-card: #f8fafc;
  --cb-primary: #2563eb;
  --cb-primary-hover: #1d4ed8;
  --cb-light-hover: #f1f5f9;
  --cb-toggle-track-off: #ebebeb;
  --cb-toggle-track-on: #d5d5d5;
  --cb-toggle-thumb: #ffffff;
  --cb-radius: 16px;
  --cb-radius-sm: 10px;
  --cb-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10);
  --cb-z: 9999990;

  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--cb-z);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cb-text);
  -webkit-font-smoothing: antialiased;
}

/* ─── Overlay ──────────────────────────────────────────── */
.cb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: var(--cb-z);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.cb-root.cb-visible .cb-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Banner Container ─────────────────────────────────── */
.cb-banner {
  position: relative;
  z-index: calc(var(--cb-z) + 1);
  background: var(--cb-bg);
  border-radius: var(--cb-radius) var(--cb-radius) 0 0;
  box-shadow: var(--cb-shadow);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}

.cb-root.cb-visible .cb-banner {
  transform: translateY(0);
}

/* ─── Initial View ─────────────────────────────────────── */
.cb-initial {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.cb-initial-text {
  flex: 1;
  min-width: 0;
}

.cb-initial-text h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--cb-text);
}

.cb-initial-text p {
  font-size: 13px;
  color: var(--cb-muted);
  margin: 0;
}

.cb-initial-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── Buttons ──────────────────────────────────────────── */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--cb-radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.cb-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.cb-btn-primary {
  background: var(--cb-primary);
  color: #ffffff;
}

.cb-btn-primary:hover {
  background: var(--cb-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.cb-btn-light {
  background: transparent;
  color: var(--cb-muted);
  border: 1.5px solid var(--cb-border);
}

.cb-btn-light:hover {
  background: var(--cb-light-hover);
  color: var(--cb-text);
  border-color: #cbd5e1;
}

/* ─── Settings Panel ───────────────────────────────────── */
.cb-settings {
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.cb-settings.cb-settings-open {
  display: flex;
}

.cb-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px 12px;
  border-bottom: 1px solid var(--cb-border);
}

.cb-settings-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.cb-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cb-card);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--cb-muted);
  font-size: 18px;
  transition: all 0.2s;
  font-family: inherit;
}

.cb-close-btn:hover {
  background: var(--cb-border);
  color: var(--cb-text);
}

/* ─── Categories ───────────────────────────────────────── */
.cb-categories {
  padding: 16px 28px;
  overflow-y: auto;
  max-height: 55vh;
  max-height: 55dvh;
  -webkit-overflow-scrolling: touch;
}

.cb-category {
  background: var(--cb-card);
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.cb-category:last-child {
  margin-bottom: 0;
}

.cb-category:hover {
  border-color: #cbd5e1;
}

/* Category Header */
.cb-cat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.cb-cat-expand {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--cb-muted);
}

.cb-cat-expand svg {
  width: 14px;
  height: 14px;
}

.cb-category.cb-cat-open .cb-cat-expand {
  transform: rotate(90deg);
}

.cb-cat-info {
  flex: 1;
  min-width: 0;
}

.cb-cat-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--cb-text);
}

.cb-cat-count {
  font-weight: 400;
  color: var(--cb-light);
  font-size: 12px;
  margin-left: 4px;
}

.cb-cat-basis {
  display: inline-block;
  font-size: 11px;
  color: var(--cb-muted);
  margin-top: 1px;
}

.cb-cat-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--cb-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Category Body (expandable) */
.cb-cat-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.cb-category.cb-cat-open .cb-cat-body {
  max-height: 2000px;
}

.cb-cat-content {
  padding: 0 16px 14px;
  border-top: 1px solid var(--cb-border);
  padding-top: 12px;
}

.cb-cat-desc {
  font-size: 13px;
  color: var(--cb-muted);
  line-height: 1.55;
  margin-bottom: 12px;
}

/* ─── Individual Entries ───────────────────────────────── */
.cb-entries {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cb-entry {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--cb-border);
  align-items: center;
}

.cb-entry:first-child {
  border-top: none;
  padding-top: 4px;
}

/* Toggle */
.cb-entry-toggle {
  flex-shrink: 0;
  position: relative;
  width: 36px;
  height: 20px;
  margin-top: 2px;
}

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

.cb-toggle-track {
  display: block;
  width: 36px;
  height: 20px;
  background: var(--cb-toggle-track-off);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.cb-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--cb-toggle-thumb);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.cb-entry-toggle input:checked + .cb-toggle-track {
  background: var(--cb-toggle-track-on);
}

.cb-entry-toggle input:checked + .cb-toggle-track .cb-toggle-thumb {
  transform: translateX(16px);
}

.cb-entry-toggle input:disabled + .cb-toggle-track {
  opacity: 0.5;
  cursor: default;
}

/* Entry Info */
.cb-entry-info {
  flex: 1;
  min-width: 0;
}

.cb-entry-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--cb-text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.cb-entry-detail {
  margin-bottom: 5px;
}

.cb-entry-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cb-light);
  display: inline;
}

.cb-entry-value {
  font-size: 11.5px;
  color: var(--cb-muted);
  display: inline;
  line-height: 1.6;
}

.cb-entry-purpose .cb-entry-value {
  display: block;
  margin-top: 1px;
  line-height: 1.65;
}

.cb-entry-meta {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--cb-border);
}

.cb-entry-meta-item {
  font-size: 11px;
  color: var(--cb-light);
}

.cb-entry-meta-item strong {
  font-weight: 600;
  color: var(--cb-muted);
}

/* ─── Settings Footer ──────────────────────────────────── */
.cb-settings-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--cb-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Links ────────────────────────────────────────────── */
.cb-links {
  display: flex;
  gap: 16px;
  padding: 0 28px 16px;
}

.cb-links a {
  font-size: 12px;
  color: var(--cb-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.cb-links a:hover {
  color: var(--cb-primary);
  text-decoration: underline;
}

/* ─── Animation ────────────────────────────────────────── */
.cb-root.cb-closing .cb-banner {
  transform: translateY(100%);
}

.cb-root.cb-closing .cb-overlay {
  opacity: 0;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .cb-initial {
    flex-direction: column;
    padding: 14px 16px;
    gap: 10px;
    text-align: left;
  }


  .cb-initial-actions {
    width: 100%;
    flex-direction: row;
    gap: 8px;
  }

  .cb-initial-actions .cb-btn {
    flex: 1;
    width: auto;
    padding: 10px 12px;
    font-size: 13px;
  }

  .cb-settings-header,
  .cb-categories,
  .cb-settings-footer,
  .cb-links {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cb-settings-footer {
    flex-direction: row;
    gap: 8px;
  }

  .cb-settings-footer .cb-btn {
    flex: 1;
    width: auto;
    padding: 10px 12px;
    font-size: 13px;
  }

  .cb-categories {
    max-height: 45vh;
    max-height: 45dvh;
  }

  .cb-entry-meta {
    flex-direction: column;
    gap: 2px;
  }
}
