/**
 * Float Button Category - Frontend Styles
 * 
 * Styling for float button and promo box based on reference design
 * 
 * @package Float_Button_Category
 */

/* CSS Variables for easy customization */
:root {
  --fbc-primary-color: #7c3aed;
  --fbc-primary-dark: #5b21b6;
  --fbc-gradient-start: #a855f7;
  --fbc-gradient-middle: #8b5cf6;
  --fbc-gradient-end: #6366f1;
  --fbc-badge-color: #ef4444;
  --fbc-text-color: #1f2937;
  --fbc-text-muted: #6b7280;
  --fbc-bg-color: #ffffff;
  --fbc-border-radius: 12px;
  --fbc-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  --fbc-button-size: 70px;
}

/* =====================================================
   FLOAT BUTTON
   ===================================================== */
.fbc-float-button {
  position: fixed;
  z-index: 99999;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.fbc-button-inner {
  position: relative;
  width: var(--fbc-button-size);
  height: var(--fbc-button-size);
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
  transition: all 0.3s ease;
}

.fbc-float-button:hover .fbc-button-inner {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.4);
}

.fbc-icon {
  width: 45px;
  height: 45px;
}

/* Custom button image */
.fbc-button-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

/* Badge */
.fbc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--fbc-badge-color);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
  border-radius: 11px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Pulse animation */
.fbc-float-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--fbc-button-size);
  height: var(--fbc-button-size);
  background: rgba(34, 197, 94, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: fbc-pulse 2s infinite;
  pointer-events: none;
}

@keyframes fbc-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* =====================================================
   PROMO BOX
   ===================================================== */
.fbc-promo-box {
  position: fixed;
  z-index: 999999;
  width: 375px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  background: var(--fbc-bg-color);
  border-radius: var(--fbc-border-radius);
  box-shadow: var(--fbc-shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-20px) scale(0.95);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s ease;
}

.fbc-promo-box.fbc-box-right {
  transform: translateX(20px) scale(0.95);
}

.fbc-promo-box.fbc-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}

/* Box Header - Matching reference gradient */
.fbc-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  background: url("/wp-content/plugins/float-button-category/bg.png");
  color: #ffffff;
}

.fbc-box-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #fff;
}

.fbc-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 100%;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.fbc-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Box Content */
.fbc-box-content {
  max-height: calc(70vh - 52px);
  overflow-y: auto;
  padding: 8px 0;
  background: #f8f9fc;
}

/* Custom scrollbar */
.fbc-box-content::-webkit-scrollbar {
  width: 4px;
}

.fbc-box-content::-webkit-scrollbar-track {
  background: transparent;
}

.fbc-box-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.fbc-box-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* =====================================================
   POST LIST
   ===================================================== */
.fbc-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fbc-post-item {
  margin: 6px 10px;
  padding: 0;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fbc-post-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}

.fbc-post-link:hover {
  background: #f8fafc;
}

/* Post Thumbnail */
.fbc-post-thumb {
  flex-shrink: 0;
  width: 65px;
  height: 65px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
}

.fbc-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Post Info */
.fbc-post-info {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.fbc-post-title {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fbc-text-color);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fbc-post-excerpt {
  margin: 0;
  font-size: 12px;
  color: var(--fbc-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hot badge */
.fbc-hot-badge {
  display: inline-block;
  padding: 2px 6px;
  margin-bottom: 4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

/* No posts message */
.fbc-no-posts {
  padding: 40px 20px;
  text-align: center;
  color: var(--fbc-text-muted);
}

/* =====================================================
   OVERLAY
   ===================================================== */
.fbc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.fbc-overlay.fbc-active {
  opacity: 1;
  visibility: visible;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

/* Tablet */
@media (max-width: 768px) {
  :root {
    --fbc-button-size: 60px;
  }

  .fbc-icon {
    width: 38px;
    height: 38px;
  }

  .fbc-promo-box {
    width: 320px;
  }

  .fbc-float-button::after {
    display: none;
  }
}

/* Mobile */
@media (max-width: 480px) {
  :root {
    --fbc-button-size: 55px;
  }

  .fbc-icon {
    width: 34px;
    height: 34px;
  }

  .fbc-promo-box {
    position: fixed;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    max-width: 100%;
    max-height: 75vh;
    border-radius: var(--fbc-border-radius) var(--fbc-border-radius) 0 0;
    transform: translateY(100%);
  }

  .fbc-promo-box.fbc-active {
    transform: translateY(0);
  }

  .fbc-post-thumb {
    width: 55px;
    height: 55px;
  }

  .fbc-badge {
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    line-height: 20px;
  }
}

/* Print styles - hide float button */
@media print {
  .fbc-float-button,
  .fbc-promo-box,
  .fbc-overlay {
    display: none !important;
  }
}
