/* ==========================================================================
   MS STUDIO — Cookie Consent & WCAG 2.1 AA Compliant Styles
   ========================================================================== */

/* --- Variables Fallback --- */
:root {
  --cookie-bg: rgba(14, 16, 20, 0.95);
  --cookie-card-bg: #141820;
  --cookie-border: rgba(84, 195, 234, 0.2);
  --cookie-accent: #54c3ea;
  --cookie-accent-hover: #38b2dc;
  --cookie-text: #f0f4f8;
  --cookie-muted: #a0aec0;
  --cookie-focus: #54c3ea;
}

/* --- Accessibility Focus Indicators (WCAG 2.4.7 Visible Focus) --- */
.cookie-banner button:focus-visible,
.cookie-modal button:focus-visible,
.cookie-switch input:focus-visible + .cookie-slider,
.cookie-footer-link:focus-visible {
  outline: 3px solid var(--cookie-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px rgba(84, 195, 234, 0.3) !important;
}

/* --- Banner (Bottom Overlay) --- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999990;
  background: var(--cookie-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--cookie-border);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  padding: 24px 20px;
  color: var(--cookie-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  animation: slideUpCookie 0.4s ease-out forwards;
}

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

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 900px) {
  .cookie-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.cookie-banner-content {
  flex: 1;
}

.cookie-banner-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
}

.cookie-banner-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--cookie-muted);
  margin: 0;
}

.cookie-banner-desc a {
  color: var(--cookie-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* --- Buttons --- */
.cookie-btn {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px; /* WCAG Target Size 44x44px */
  white-space: nowrap;
}

.cookie-btn-primary {
  background: var(--cookie-accent);
  color: #0c1015;
  border-color: var(--cookie-accent);
}

.cookie-btn-primary:hover {
  background: var(--cookie-accent-hover);
  border-color: var(--cookie-accent-hover);
  box-shadow: 0 0 16px rgba(84, 195, 234, 0.4);
}

.cookie-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.cookie-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.cookie-btn-outline {
  background: transparent;
  color: var(--cookie-accent);
  border-color: var(--cookie-border);
}

.cookie-btn-outline:hover {
  background: rgba(84, 195, 234, 0.1);
  border-color: var(--cookie-accent);
}

/* --- Modal Dialog (Granular Settings) --- */
.cookie-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999995;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInCookie 0.25s ease-out forwards;
}

@keyframes fadeInCookie {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cookie-modal {
  background: var(--cookie-card-bg);
  border: 1px solid var(--cookie-border);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  color: var(--cookie-text);
  overflow: hidden;
}

.cookie-modal-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cookie-modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
}

.cookie-modal-close {
  background: transparent;
  border: none;
  color: var(--cookie-muted);
  font-size: 1.5rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.cookie-modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.cookie-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cookie-category {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cookie-category-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cookie-category-desc {
  font-size: 0.85rem;
  color: var(--cookie-muted);
  line-height: 1.45;
  margin: 0;
}

/* --- Accessible Toggle Switch --- */
.cookie-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

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

.cookie-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cookie-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

.cookie-switch input:checked + .cookie-slider {
  background-color: var(--cookie-accent);
}

.cookie-switch input:checked + .cookie-slider:before {
  transform: translateX(22px);
  background-color: #0c1015;
}

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

.cookie-modal-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

/* --- Footer Trigger Link --- */
.cookie-footer-link {
  color: var(--cookie-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: inherit;
  transition: color 0.2s ease;
}

.cookie-footer-link:hover {
  color: var(--cookie-accent);
}
