/* ==============================================
   Cookie Consent — Clínica Dental Cravident
   GDPR / LSSI-CE
   ============================================== */

/* Anula el margin:0 auto global del sitio para todos los elementos de cookies */
#cc-banner *,
#cc-modal * {
  margin: 0;
  box-sizing: border-box;
}

/* ---- Banner ---- */
#cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  background: #1a1a1a;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  padding: 18px 5%;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.4);
  flex-wrap: wrap;
  overflow: hidden;
  box-sizing: border-box;
}

#cc-banner .cc-banner-text {
  flex: 1 1 280px;
  margin: 0;
  min-width: 0;
}

#cc-banner .cc-banner-text p {
  font-size: 0.82em;
  color: #bbb;
  margin: 0;
  padding: 0;
  width: auto;
  max-width: none;
  text-align: left;
  line-height: 1.55;
}

#cc-banner .cc-banner-text a {
  color: #fff;
  text-decoration: underline;
}

#cc-banner .cc-banner-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin: 0;
}

/* ---- Buttons ---- */
.cc-btn {
  font-family: inherit;
  font-size: 0.85em;
  padding: 9px 20px;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  border: none;
  line-height: 1.4;
}

.cc-btn:hover { opacity: 0.8; }

.cc-btn-primary {
  background: #fff;
  color: #1a1a1a;
}

.cc-btn-primary-dark {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #aaa;
}

.cc-btn-primary-dark:focus {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  outline: none;
}

.cc-btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
}

.cc-btn-outline-dark {
  background: transparent;
  color: #333;
  border: 1px solid #aaa;
}

.cc-btn-outline-dark:focus {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  outline: none;
}

.cc-btn-ghost {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #aaa;
}

.cc-btn-ghost:focus {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  outline: none;
}

.cc-btn-pressed {
  background: #1a1a1a !important;
  color: #fff !important;
  border-color: #1a1a1a !important;
}

/* ---- Modal overlay ---- */
#cc-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* ---- Modal box ---- */
.cc-modal-box {
  background: #fff;
  border-radius: 6px;
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
  margin: 0;
  box-sizing: border-box;
}

/* ---- Modal head ---- */
.cc-modal-head {
  padding: 26px 28px 18px;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
}

.cc-modal-head h2 {
  font-size: 1.15em !important;
  font-weight: 600 !important;
  color: #111 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 0 8px !important;
  line-height: 1.3;
}

.cc-modal-head p {
  font-size: 0.82em !important;
  color: #666 !important;
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  max-width: none !important;
  text-align: left !important;
  line-height: 1.5;
}

/* ---- Modal body ---- */
.cc-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 0 28px;
}

/* ---- Category ---- */
.cc-cat {
  padding: 18px 0;
  border-bottom: 1px solid #f0f0f0;
}

.cc-cat:last-child { border-bottom: none; }

.cc-cat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.cc-cat-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cc-cat-info strong {
  font-size: 0.9em;
  color: #111;
  font-weight: 600;
}

.cc-cat-info span {
  font-size: 0.78em;
  color: #777;
  line-height: 1.45;
}

/* ---- Toggle switch ---- */
.cc-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cc-always-on {
  font-size: 0.72em;
  color: #4caf50;
  font-weight: 600;
  white-space: nowrap;
}

.cc-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}

.cc-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cc-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.25s;
}

.cc-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cc-toggle input:checked + .cc-slider { background: #2979ff; }
.cc-toggle input:checked + .cc-slider::before { transform: translateX(20px); }
.cc-toggle input:disabled + .cc-slider { background: #4caf50; cursor: not-allowed; }

/* ---- Cookie table ---- */
.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76em;
  color: #555;
  margin-top: 4px;
}

.cc-table th {
  background: #f6f6f6;
  text-align: left;
  padding: 6px 10px;
  font-weight: 600;
  color: #444;
  border-bottom: 1px solid #ebebeb;
}

.cc-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: top;
  line-height: 1.4;
}

.cc-table tr:last-child td { border-bottom: none; }

/* ---- Modal footer ---- */
.cc-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid #ebebeb;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cc-foot-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Responsive ---- */
@media (max-width: 620px) {
  /* Banner */
  #cc-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 5%;
  }

  #cc-banner .cc-banner-text {
    width: 100%;
  }

  #cc-banner .cc-banner-actions {
    width: 100%;
  }

  #cc-banner .cc-banner-actions .cc-btn {
    flex: 1;
    text-align: center;
  }

  /* Modal: bottom sheet */
  #cc-modal {
    padding: 0;
    align-items: flex-end;
  }

  .cc-modal-box {
    border-radius: 14px 14px 0 0;
    max-height: 92vh;
    max-width: 100%;
    width: 100%;
  }

  .cc-modal-head {
    padding: 20px 16px 14px;
  }

  .cc-modal-body {
    padding: 0 16px;
  }

  /* Table: ocultar columna Caducidad y ajustar texto */
  .cc-table th:last-child,
  .cc-table td:last-child {
    display: none;
  }

  .cc-table th,
  .cc-table td {
    white-space: normal;
  }

  /* Footer buttons: apilados */
  .cc-modal-foot {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px 24px;
  }

  .cc-foot-right {
    flex-direction: column;
    gap: 8px;
  }

  .cc-modal-foot .cc-btn,
  .cc-foot-right .cc-btn {
    width: 100%;
    text-align: center;
    white-space: normal;
    padding: 12px 16px;
  }
}
