/**
 * QDAY GDPR Compliance Suite — Frontend Styles
 * Responsive, glassmorphism & slate design tokens matching QDAY.
 */

:root {
  --qday-primary: #0284c7;
  --qday-primary-hover: #0369a1;
  --qday-bg-dark: #0f172a;
  --qday-surface-dark: #1e293b;
  --qday-border-dark: #334155;
  --qday-text-dark: #f8fafc;
  --qday-muted-dark: #94a3b8;
  --qday-accent: #e11d48;
  --qday-success: #10b981;
}

/* ==========================================================================
   1. Primary Consent Banner
   ========================================================================== */
.qday-gdpr-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--qday-text-dark);
}

.qday-gdpr-banner {
  position: fixed;
  z-index: 999990;
  box-sizing: border-box;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  animation: qdayFadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Floating Card Layout */
.qday-layout-floating_card {
  bottom: 24px;
  left: 24px;
  max-width: 480px;
  width: calc(100% - 48px);
  border-radius: 14px;
}

/* Bottom Bar Layout */
.qday-layout-bottom_bar {
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  border-radius: 0;
  border-top: 1px solid var(--qday-border-dark);
}

/* Modal Layout */
.qday-layout-modal {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 540px;
  width: 90%;
  border-radius: 16px;
}

/* Theme: Dark */
.qday-theme-dark .qday-gdpr-banner,
.qday-theme-dark .qday-modal-box {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--qday-border-dark);
  color: var(--qday-text-dark);
}

/* Theme: Light */
.qday-theme-light .qday-gdpr-banner,
.qday-theme-light .qday-modal-box {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #e2e8f0;
  color: #0f172a;
}
.qday-theme-light .qday-banner-desc,
.qday-theme-light .qday-modal-subtitle,
.qday-theme-light .qday-cat-info p {
  color: #475569 !important;
}

/* Banner Inner */
.qday-banner-inner {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.qday-layout-bottom_bar .qday-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.qday-banner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.qday-banner-icon {
  font-size: 18px;
}
.qday-banner-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
}
.qday-banner-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--qday-muted-dark);
}
.qday-policy-link {
  color: var(--qday-primary);
  text-decoration: underline;
  margin-left: 4px;
  font-weight: 600;
}
.qday-policy-link:hover {
  color: var(--qday-primary-hover);
}

.qday-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Buttons */
.qday-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  outline: none;
}
.qday-btn-primary {
  background: var(--qday-primary);
  color: #ffffff;
}
.qday-btn-primary:hover {
  background: var(--qday-primary-hover);
  transform: translateY(-1px);
}
.qday-btn-secondary {
  background: transparent;
  border: 1px solid var(--qday-border-dark);
  color: inherit;
}
.qday-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}
.qday-btn-outline {
  background: transparent;
  border: 1px dashed var(--qday-border-dark);
  color: var(--qday-muted-dark);
}
.qday-btn-outline:hover {
  color: #ffffff;
  border-color: var(--qday-primary);
}
.qday-btn-save {
  background: var(--qday-success);
  color: #ffffff;
}
.qday-btn-save:hover {
  background: #059669;
}

/* ==========================================================================
   2. Preferences Modal
   ========================================================================== */
.qday-gdpr-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999995;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: qdayFadeIn 0.2s ease;
}

.qday-modal-box {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.qday-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--qday-border-dark);
}
.qday-modal-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}
.qday-modal-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--qday-muted-dark);
}
.qday-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--qday-muted-dark);
  cursor: pointer;
}
.qday-modal-close-btn:hover {
  color: #ffffff;
}

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

.qday-cat-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--qday-border-dark);
  border-radius: 10px;
}
.qday-theme-light .qday-cat-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.qday-cat-info {
  flex: 1;
}
.qday-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.qday-cat-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.qday-cat-info p {
  margin: 0;
  font-size: 12.5px;
  color: var(--qday-muted-dark);
  line-height: 1.4;
}

.qday-badge-always {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Switch Toggle */
.qday-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.qday-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.qday-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #475569;
  transition: 0.3s;
  border-radius: 24px;
}
.qday-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
.qday-switch input:checked + .qday-slider {
  background-color: var(--qday-primary);
}
.qday-switch input:checked + .qday-slider:before {
  transform: translateX(20px);
}
.qday-slider.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.qday-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--qday-border-dark);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   3. Floating Revisit Badge
   ========================================================================== */
.qday-revisit-badge {
  position: fixed;
  bottom: 20px;
  z-index: 999980;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border: 1px solid var(--qday-border-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.qday-revisit-badge:hover {
  background: var(--qday-primary);
  transform: scale(1.05);
}
.qday-pos-bottom-left {
  left: 20px;
}
.qday-pos-bottom-right {
  right: 20px;
}

/* ==========================================================================
   4. Blocked Embed Placeholder Box
   ========================================================================== */
.qday-blocked-embed-box {
  box-sizing: border-box;
  margin: 1.5rem 0;
  padding: 2.5rem 1.5rem;
  background: #0f172a;
  color: #f8fafc;
  border: 2px dashed #334155;
  border-radius: 12px;
  text-align: center;
}
.qday-blocked-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.qday-blocked-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
}
.qday-blocked-text {
  margin: 0 auto 16px;
  font-size: 13.5px;
  color: #94a3b8;
  max-width: 520px;
}
.qday-btn-unblock {
  background: var(--qday-primary);
  color: #ffffff;
  padding: 10px 20px;
  font-size: 13.5px;
}
.qday-btn-unblock:hover {
  background: var(--qday-primary-hover);
}

/* ==========================================================================
   5. Dynamic Cookie Tables & SAR Form
   ========================================================================== */
.qday-cookie-table-container {
  margin: 1.5rem 0;
}
.qday-cookie-cat-section {
  margin-bottom: 2rem;
}
.qday-cookie-cat-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}
.qday-table-responsive {
  overflow-x: auto;
}
.qday-cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-bottom: 1rem;
}
.qday-cookie-table th,
.qday-cookie-table td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid #cbd5e1;
}
.qday-cookie-table th {
  background: #f1f5f9;
  font-weight: 600;
}

/* SAR Form */
.qday-sar-form-container {
  margin: 2rem 0;
}
.qday-sar-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 24px;
  max-width: 640px;
}
.qday-sar-header h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.qday-sar-header p {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 13.5px;
}
.qday-form-group {
  margin-bottom: 16px;
}
.qday-form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13.5px;
}
.qday-form-group input,
.qday-form-group select,
.qday-form-group textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
}
.qday-sar-feedback {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13.5px;
}
.qday-sar-feedback.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.qday-sar-feedback.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* RTL Support */
.qday-rtl {
  direction: rtl;
  text-align: right;
}
.qday-rtl .qday-banner-header {
  flex-direction: row-reverse;
}
.qday-rtl .qday-cookie-table th,
.qday-rtl .qday-cookie-table td {
  text-align: right;
}

/* Keyframes */
@keyframes qdayFadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes qdayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 640px) {
  .qday-layout-floating_card {
    left: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
  .qday-banner-inner {
    padding: 16px;
  }
  .qday-banner-actions {
    flex-direction: column;
  }
  .qday-btn {
    width: 100%;
  }
}
