/* Cookie Consent Banner Styles */

/* Banner overlay and container */
.cookie-consent-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  isolation: isolate;
}

.cookie-consent-banner {
  background: #ffffff;
  border-top: 3px solid #007bff;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 1.5rem;
  max-height: 90vh;
  overflow-y: auto;
}

/* Banner header */
.cookie-consent-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.cookie-consent-header i {
  font-size: 1.5rem;
  color: #007bff;
  margin-right: 0.75rem;
}

.cookie-consent-header h4 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #333;
}

/* Banner description */
.cookie-consent-description {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.cookie-consent-description a {
  color: #007bff;
  text-decoration: underline;
}

/* Category cards */
.cookie-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.cookie-category {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cookie-category:hover {
  border-color: #007bff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.cookie-category.category-essential {
  background: #e7f5ff;
  border-color: #74c0fc;
}

.cookie-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cookie-category-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.cookie-category-description {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.4;
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

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

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

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

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
  background-color: #28a745;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Essential badge */
.cookie-essential-badge {
  font-size: 0.7rem;
  background: #28a745;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Action buttons */
.cookie-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-bottom: 1rem;
}

/* Mobile scroll hint - hidden on desktop, shown on mobile via media query */
.cookie-scroll-hint {
  display: none;
  font-size: 0.9375rem;
  color: #4a4a4a;
  text-align: left;
  margin-bottom: 0.875rem;
  margin-top: 0;
  padding: 0.75rem 1rem;
  background: #fffbeb;
  border-radius: 8px;
  font-style: normal;
  font-weight: 400;
  border: 1px solid #fcd34d;
  line-height: 1.4;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  align-items: center;
  gap: 0.75rem;
}

.cookie-scroll-hint::before {
  content: "\f071";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  color: #fbbf24;
  font-size: 1.5rem;
  flex-shrink: 0;
  font-style: normal;
}

.cookie-btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cookie-btn-accept-all {
  background: #28a745;
  color: white;
}

.cookie-btn-accept-all:hover {
  background: #218838;
  transform: translateY(-1px);
}

.cookie-btn-save {
  background: #007bff;
  color: white;
}

.cookie-btn-save:hover {
  background: #0069d9;
  transform: translateY(-1px);
}

.cookie-btn-reject {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #dee2e6;
}

.cookie-btn-reject:hover {
  background: #e9ecef;
  color: #333;
}

/* Hide banner when consent given */
.cookie-consent-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* DNT notice */
.cookie-dnt-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cookie-dnt-notice i {
  color: #856404;
}

.cookie-dnt-notice span {
  font-size: 0.85rem;
  color: #856404;
}

/* Responsive adjustments */
@media (max-width: 576px) {
  /* Keep overlay full screen but limit banner height */
  .cookie-consent-overlay {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    /* Add GSFT logo watermark on mobile only with transparency */
    background: 
      linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
      var(--cookie-overlay-logo, url('/images/public/logos/Main_logo_wAlpha_wSurround_small.webp?format=webp&width=900')) center 50px / 200px no-repeat;
    background-blend-mode: normal;
  }

  .cookie-consent-banner {
    padding: 1rem;
    max-height: 50vh;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  /* Show mobile scroll hint */
  .cookie-scroll-hint {
    display: flex;
  }

  .cookie-consent-header {
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
  }

  .cookie-consent-header h4 {
    font-size: 1.15rem;
    margin: 0;
    font-weight: 600;
  }

  .cookie-consent-header i {
    font-size: 1.5rem;
    color: #007bff;
    flex-shrink: 0;
  }

  .cookie-consent-description {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  .cookie-categories {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .cookie-category {
    padding: 0.75rem;
  }

  .cookie-category-name {
    font-size: 0.9rem;
  }

  .cookie-category-description {
    font-size: 0.75rem;
  }

  .cookie-consent-actions {
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 5rem;
  }

  .cookie-btn {
    width: 100%;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Manager Account page - Cookie Preferences section */
.cookie-preferences-section {
  margin-top: 1.5rem;
}

.cookie-preferences-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.25rem;
}

.cookie-preferences-card h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
}

.cookie-preferences-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e9ecef;
}

.cookie-preferences-item:last-child {
  border-bottom: none;
}

.cookie-preferences-label {
  display: flex;
  flex-direction: column;
}

.cookie-preferences-label span:first-child {
  font-weight: 500;
  color: #333;
}

.cookie-preferences-label span:last-child {
  font-size: 0.8rem;
  color: #666;
}

.cookie-consent-status {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.75rem;
}

.cookie-consent-status strong {
  color: #333;
}

/* ===========================================
   AUTH PAGE OVERRIDES
   The .page--auth * reset strips margins/padding.
   These overrides restore cookie consent styling.
   =========================================== */
.page--auth .cookie-consent-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: none;
}

.page--auth .cookie-consent-banner {
  padding: 1.5rem;
  max-width: none;
}

.page--auth .cookie-consent-banner .container {
  max-width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}

.page--auth .cookie-consent-header {
  margin-bottom: 1rem;
}

.page--auth .cookie-consent-header h4 {
  margin: 0;
}

.page--auth .cookie-consent-description {
  margin-bottom: 1.25rem;
}

.page--auth .cookie-categories {
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.page--auth .cookie-category {
  padding: 1rem;
  margin: 0;
}

.page--auth .cookie-category-header {
  margin-bottom: 0.5rem;
}

.page--auth .cookie-essential-badge {
  padding: 2px 6px;
}

.page--auth .cookie-category-description {
  margin: 0;
}

.page--auth .cookie-consent-actions {
  gap: 0.75rem;
  margin: 0;
}

.page--auth .cookie-btn {
  padding: 0.625rem 1.25rem;
  margin: 0;
}

.page--auth .cookie-scroll-hint {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
}

/* Manager Account - Cookie Preferences toggles larger on mobile */
@media (max-width: 576px) {
  #cookiePreferencesForm .form-switch {
    padding-left: 4rem;
  }
  
  #cookiePreferencesForm .form-switch .form-check-input {
    width: 3.5rem;
    height: 1.75rem;
    margin-left: -4rem;
  }
}
