/* ==========================================================================
   Literating India Foundation — Cookie Consent Banner & Preferences Modal
   WCAG 2.1 AA Compliant: High Contrast, Focus Trap, Accessible ARIA
   ========================================================================== */

/* Banner Container */
.lif-cookie-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 99998;
  background: rgba(11, 37, 69, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #FFFFFF;
  border-top: 2px solid #1B4F9C;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  padding: 1.25rem 1.5rem;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.lif-cookie-banner.is-visible {
  display: block !important;
  transform: translateY(0);
  opacity: 1;
}

.lif-cookie-container {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 860px) {
  .lif-cookie-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }
}

.lif-cookie-text {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #D9E3F2;
}

.lif-cookie-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 0.35rem;
}

.lif-cookie-text a {
  color: #FFD54F;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.lif-cookie-text a:hover,
.lif-cookie-text a:focus-visible {
  color: #FFFFFF;
  outline: 2px solid #FFD54F;
  outline-offset: 2px;
}

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

.lif-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  border-radius: 4px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lif-btn:focus-visible {
  outline: 3px solid #FFD54F;
  outline-offset: 2px;
}

.lif-btn-primary {
  background-color: #1B4F9C;
  color: #FFFFFF;
  border-color: #2D68C4;
}

.lif-btn-primary:hover {
  background-color: #123A73;
}

.lif-btn-secondary {
  background-color: transparent;
  color: #FFFFFF;
  border-color: #BFD0E8;
}

.lif-btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #FFFFFF;
}

.lif-btn-link {
  background: none;
  border: none;
  color: #D9E3F2;
  text-decoration: underline;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.lif-btn-link:hover,
.lif-btn-link:focus-visible {
  color: #FFD54F;
}

/* Modal Overlay */
.lif-cookie-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  inset: 0;
  z-index: 99999;
  background: rgba(5, 23, 46, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lif-cookie-modal-backdrop.is-open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.lif-cookie-modal {
  background: #FFFFFF;
  color: #0B2545;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #D9E3F2;
}

.lif-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #D9E3F2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
}

.lif-modal-header h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: #0B2545;
}

.lif-modal-close-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: #5B6B7C;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lif-modal-close-btn:hover {
  background: #EAF1FB;
  color: #0B2545;
}

.lif-modal-close-btn:focus-visible {
  outline: 2px solid #1B4F9C;
  outline-offset: 2px;
}

.lif-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lif-modal-desc {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #5B6B7C;
  margin: 0;
}

.lif-consent-group {
  border: 1px solid #D9E3F2;
  border-radius: 6px;
  padding: 1rem 1.15rem;
  background: #FFFFFF;
  transition: border-color 0.15s ease;
}

.lif-consent-group:focus-within {
  border-color: #1B4F9C;
}

.lif-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.lif-group-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0B2545;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lif-badge-always-active {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: #E8F5E9;
  color: #1E7E34;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lif-group-desc {
  font-size: 0.84375rem;
  color: #5B6B7C;
  line-height: 1.5;
  margin: 0;
}

/* Switch UI */
.lif-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.lif-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #BFD0E8;
  transition: 0.2s;
  border-radius: 24px;
}

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

.lif-switch input:checked + .lif-slider {
  background-color: #1B4F9C;
}

.lif-switch input:focus-visible + .lif-slider {
  outline: 3px solid #1B4F9C;
  outline-offset: 2px;
}

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

.lif-switch input:disabled + .lif-slider {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #1E7E34;
}

.lif-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #D9E3F2;
  background: #F8FAFC;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
}

/* Form Consent Checkbox UI */
.form-consent-box {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  background: #F8FAFC;
  border: 1px solid #D9E3F2;
}

.form-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #334155;
}

.form-consent-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: #1B4F9C;
  cursor: pointer;
  flex-shrink: 0;
}

.form-consent-row input[type="checkbox"]:focus-visible {
  outline: 2px solid #1B4F9C;
  outline-offset: 2px;
}

.form-consent-row label {
  cursor: pointer;
  margin-bottom: 0;
}

.form-consent-row a {
  color: #1B4F9C;
  text-decoration: underline;
  font-weight: 600;
}

.form-consent-minor {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #D9E3F2;
}

/* Footer Legal Block */
.footer-legal-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(217, 227, 242, 0.15);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #9DB0C6;
}

.footer-legal-block strong {
  color: #FFFFFF;
  font-weight: 600;
}

.footer-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-top: 0.75rem;
}

.footer-legal-links a,
.footer-legal-links button {
  color: #D9E3F2;
  text-decoration: none;
  font-size: 0.8125rem;
  transition: color 0.15s ease;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.footer-legal-links a:hover,
.footer-legal-links button:hover,
.footer-legal-links a:focus-visible,
.footer-legal-links button:focus-visible {
  color: #FFD54F;
  text-decoration: underline;
  outline: 2px solid #FFD54F;
  outline-offset: 2px;
}

/* Legal Pages Typography & Accessibility */
.legal-content a {
  color: var(--blue, #1B4F9C);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-content a:hover,
.legal-content a:focus-visible {
  color: var(--blue-deep, #0B2545);
  text-decoration: underline;
}

