/* ==========================================================================
   CFM Floating Tools — frontend styles
   ========================================================================== */

:root {
  --cfm-ft-btn-bg: #1A73E8;
  --cfm-ft-btn-color: #ffffff;
}

/* ---- Floating toggle button ---- */
.cfm-ft-toggle {
  position: fixed;
  top: 20px;
  z-index: 999998;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--cfm-ft-btn-bg);
  color: var(--cfm-ft-btn-color);
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.cfm-ft-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}

.cfm-ft-toggle.cfm-ft-pos-right {
  right: 24px;
}

.cfm-ft-toggle.cfm-ft-pos-left {
  left: 24px;
}

.cfm-ft-toggle-icon {
  display: inline-flex;
  color: var(--cfm-ft-btn-color);
}

@media (max-width: 600px) {
  .cfm-ft-toggle {
    top: 16px;
    padding: 12px 16px;
    font-size: 12px;
  }
  .cfm-ft-toggle.cfm-ft-pos-right {
    right: 16px;
  }
  .cfm-ft-toggle.cfm-ft-pos-left {
    left: 16px;
  }
}

/* ---- Modal ---- */
.cfm-ft-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cfm-ft-modal[hidden] {
  display: none;
}

.cfm-ft-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 20, 0.6);
  backdrop-filter: blur(2px);
}

.cfm-ft-modal-panel {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cfm-ft-pop-in 0.2s ease;
}

@keyframes cfm-ft-pop-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.cfm-ft-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #eef0f3;
  flex-shrink: 0;
}

.cfm-ft-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #042A59;
}

.cfm-ft-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f2f4f7;
  color: #042A59;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.cfm-ft-modal-close:hover {
  background: #e2e6ec;
}

.cfm-ft-modal-body {
  overflow-y: auto;
  padding: 8px 24px 24px;
}

/* ---- Category rows ---- */
.cfm-ft-category {
  margin-top: 20px;
}

.cfm-ft-category-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.cfm-ft-category-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000;
}

.cfm-ft-count {
  font-size: 12px;
  color: #8a8f98;
}

/* ---- Scrollable nav (reuses the original image-nav pattern) ---- */
.cfm-ft-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cfm-ft-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.cfm-ft-nav {
  display: flex;
  flex-direction: row;
  padding: 16px 0;
  width: max-content;
  min-width: 100%;
  align-items: flex-start;
  gap: 28px;
}

.cfm-ft-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-decoration: none !important;
  flex: 0 0 auto;
  width: 120px;
  cursor: pointer;
}

.cfm-ft-item-img {
  position: relative;
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 10px;
  background: #f5f5f5;
}

.cfm-ft-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.cfm-ft-item:hover .cfm-ft-item-img img {
  transform: scale(1.06);
}

.cfm-ft-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #e0392b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
}

.cfm-ft-item-label {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #000;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 120px;
  min-height: 2.6em;
}

.cfm-ft-item:hover .cfm-ft-item-label {
  color: #042A59;
}

/* ---- Body scroll lock while modal is open ---- */
body.cfm-ft-modal-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .cfm-ft-modal {
    padding: 0;
  }
  .cfm-ft-modal-panel {
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }
  .cfm-ft-item,
  .cfm-ft-item-img {
    width: 92px;
  }
  .cfm-ft-item-label {
    max-width: 92px;
    font-size: 9px;
  }
}
