/* GDPR Cookie Banner - Organic Chemistry Academy */

.cookie-banner-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  border-top: 3px solid #f1d204;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  animation: slideUp 0.5s ease-out;
  transform-origin: bottom;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 40px 20px;
}

.cookie-banner-text {
  margin-bottom: 20px;
  color: #333;
  font-size: 15px;
  line-height: 1.5;
}

.cookie-banner-text a {
  color: #6a4d8a;
  text-decoration: underline;
}

.cookie-banner-text a:hover {
  color: #f1d204;
}

.cookie-banner-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.cookie-banner-buttons button {
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
}

.cookie-banner-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-accept-all {
  background-color: #6a4d8a;
  color: white;
}

.btn-accept-all:hover {
  background-color: #553d6d;
}

.btn-reject-all {
  background-color: #6a4d8a;
  color: white;
}

.btn-reject-all:hover {
  background-color: #553d6d;
}

.btn-preferences {
  color: #6a4d8a;
  font-weight: 500;
  text-decoration: underline;
  padding: 12px 16px;
  border: 2px solid #6a4d8a;
  background: transparent;
  transition: all 0.3s ease;
}

.btn-preferences:hover {
  background-color: rgba(106, 77, 138, 0.1);
}

.cookie-categories {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  display: block;
}

.cookie-category-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #dee2e6;
}

.cookie-category-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cookie-category-details {
  flex: 1;
  padding-right: 16px;
}

.cookie-category-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  color: #333;
}

.cookie-category-description {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 8px;
}

.cookie-category-managers {
  font-size: 13px;
  color: #888;
}

.cookie-category-cookies {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cookie-detail {
  font-size: 13px;
  line-height: 1.5;
}

.cookie-detail-name {
  font-family: monospace;
  font-weight: bold;
  color: #6a4d8a;
  margin-bottom: 2px;
}

.cookie-detail-info {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: 2px;
  color: #666;
}

.cookie-detail-type {
  font-style: italic;
  color: #999;
}

.cookie-detail-duration {
  color: #888;
}

.cookie-category-toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.cookie-category-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-category-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 28px;
}

.cookie-category-toggle .slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-category-toggle input:disabled + .slider {
  opacity: 0.6;
  cursor: not-allowed;
}

.cookie-category-toggle input:checked + .slider {
  background-color: #6a4d8a;
}

.cookie-category-toggle input:focus + .slider {
  box-shadow: 0 0 1px #6a4d8a;
}

.cookie-category-toggle input:checked + .slider:before {
  transform: translateX(24px);
}

.cookie-category-item.needs-consent .cookie-category-toggle {
  opacity: 1;
}

.cookie-category-item.needs-consent .cookie-category-toggle input:checked + .slider {
  background-color: #28a745;
}

.cookie-category-item.needs-consent .cookie-category-toggle input:checked + .slider:before {
  background-color: white;
}

.cookie-category-desc-toggle button {
  background: none;
  border: none;
  color: #6a4d8a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  text-decoration: none;
}

.cookie-category-desc-toggle button:hover {
  background-color: rgba(106, 77, 138, 0.1);
}

.cookie-allowed-text {
  background-color: #e8f5e9;
  color: #2e7d32;
  padding: 12px 16px;
  border-radius: 6px;
  display: none;
  font-size: 14px;
  margin-top: 16px;
}

.cookie-allowed-text.show {
  display: block;
}

.cookie-allowed-text a {
  color: #2e7d32;
  font-weight: 600;
  text-decoration: underline;
}

/* Cookie preferences modal overlay */
.cookie-preferences-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding-bottom: env(safe-area-inset-bottom);
}

.cookie-preferences-overlay.show {
  display: flex;
}

.cookie-preferences-modal {
  background-color: white;
  width: 85%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
  margin-bottom: env(safe-area-inset-bottom);
}

.cookie-preferences-header {
  padding: 20px 24px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cookie-preferences-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.cookie-preferences-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.3s ease;
}

.cookie-preferences-close:hover {
  color: #333;
}

.cookie-preferences-body {
  padding: 24px;
}

.cookie-preferences-footer {
  padding: 20px 24px;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 12px 12px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.cookie-preferences-footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cookie-preferences-footer .btn-close-preferences {
  background-color: #6a4d8a;
  color: white;
}

.cookie-preferences-footer .btn-save {
  background-color: #6a4d8a;
  color: white;
}

.cookie-preferences-footer button:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Responsive design */
@media (max-width: 768px) {
  .cookie-banner-content {
    padding: 16px 16px 30px 16px;
  }

  .cookie-banner-buttons {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .cookie-banner-buttons button {
    width: 100%;
  }

  .btn-preferences {
    text-align: center;
  }

  .cookie-category-item {
    flex-direction: column;
    gap: 12px;
  }

  .cookie-category-details {
    padding-right: 0;
  }

  .cookie-preferences-modal {
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Cookie banner hidden by default until loaded */
/* The banner strip itself starts hidden; the wrapper must stay visible so
   the footer's "Manage Preferences" link can open the preferences modal
   even when consent was already given. */
.cookie-banner-modal {
  display: none;
}

#gdpr-cookie-banner.loaded .cookie-banner-modal {
  display: block;
}

#gdpr-cookie-preferences {
  display: none;
}

#gdpr-cookie-preferences.loaded {
  display: block;
}