/* ============================================
   SMART BANNER COMPONENT
   ============================================ */

.smart-banner {
  position: fixed;
  left: -400px;
  top: 50%;
  transform: translateY(-50%);
  width: 340px;
  max-width: calc(100vw - 40px);
  z-index: 9999;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, rgba(102, 126, 234, 0.08) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-left: none;
  border-radius: 0 1.5rem 1.5rem 0;
  box-shadow: 8px 8px 32px rgba(0, 0, 0, 0.3), 4px 4px 16px rgba(0, 212, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.smart-banner.visible {
  left: 0;
}

/* Banner content - clickable */
.smart-banner__content {
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

.smart-banner__content:hover {
  background: rgba(0, 212, 255, 0.05);
}

.smart-banner__content:hover .smart-banner__thumbnail {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 212, 255, 0.3);
  transform: scale(1.02);
}

.smart-banner__content:hover .smart-banner__icon {
  transform: scale(1.1);
}

.smart-banner__content:active {
  transform: scale(0.98);
}

/* Main icon */
.smart-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(102, 126, 234, 0.15));
  border-radius: 1rem;
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #00d4ff;
  margin: 0 auto;
  animation: pulse-glow 2.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
  }
}

/* Text content */
.smart-banner__text {
  text-align: center;
}

.smart-banner__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.smart-banner__description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* PDF Thumbnail */
.smart-banner__thumbnail {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.smart-banner__thumbnail-icon {
  font-size: 2.5rem;
  color: #8b7fd8;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(139, 127, 216, 0.4));
  display: flex;
  align-items: center;
  justify-content: center;
}

.smart-banner__thumbnail-icon i {
  display: flex;
  align-items: center;
  justify-content: center;
}

.smart-banner__thumbnail-icon i::before {
  margin: 0 !important;
  padding: 0 !important;
}

.smart-banner__thumbnail-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.smart-banner__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #00ff88;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.5rem;
  background: rgba(0, 255, 136, 0.15);
  border-radius: 0.25rem;
  width: fit-content;
}

.smart-banner__filename {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
   SMART BANNER FORM & LEAD CAPTURE
   ============================================ */

/* Phase visibility */
.smart-banner__form-phase {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.smart-banner__success-phase {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.75rem 1.5rem;
  text-align: center;
  animation: bannerFadeIn 0.4s ease-out;
}

.smart-banner--submitted .smart-banner__form-phase {
  display: none;
}

.smart-banner--submitted .smart-banner__success-phase {
  display: flex;
}

/* Form layout */
.smart-banner__form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.smart-banner__input-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.smart-banner__input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg, 0.75rem);
  color: var(--text-primary, #fff);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.smart-banner__input::placeholder {
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
}

.smart-banner__input:focus {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.smart-banner__input--error {
  border-color: rgba(255, 85, 85, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 85, 85, 0.1);
}

.smart-banner__submit {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(45deg, #00d4ff, #0066ff);
  border: none;
  border-radius: var(--radius-lg, 0.75rem);
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.smart-banner__submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

.smart-banner__submit:active {
  transform: scale(0.97);
}

.smart-banner__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading state */
.smart-banner__submit--loading .smart-banner__submit-text {
  visibility: hidden;
}

.smart-banner__submit-loader {
  display: none;
}

.smart-banner__submit--loading .smart-banner__submit-loader {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bannerSpin 0.6s linear infinite;
}

/* Error message */
.smart-banner__error {
  font-size: 0.75rem;
  color: #ff5555;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  opacity: 0;
}

.smart-banner__error--visible {
  opacity: 1;
  min-height: 1rem;
}

/* Privacy notice */
.smart-banner__privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
  margin: 0;
}

.smart-banner__privacy i {
  font-size: 0.65rem;
  color: rgba(0, 212, 255, 0.6);
}

/* Success state */
.smart-banner__success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 136, 0.3);
  animation: bannerSuccessPulse 1.5s ease-in-out;
}

.smart-banner__success-text {
  font-size: 0.875rem;
  color: #00ff88;
  font-weight: 600;
  margin: 0;
}

@keyframes bannerSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes bannerFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bannerSuccessPulse {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Entry animation */
@keyframes slideInFromLeft {
  from {
    left: -400px;
    opacity: 0;
  }
  to {
    left: 0;
    opacity: 1;
  }
}

.smart-banner.visible {
  animation: slideInFromLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ============================================
   SMART BANNER TAB - Visible when banner hidden
   ============================================ */

.smart-banner__tab {
  position: fixed;
  left: -60px;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  padding: 1rem 0.5rem;
  background: var(--card-bg-modern);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border-modern);
  border-left: none;
  border-radius: 0 1rem 1rem 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.smart-banner__tab.visible {
  left: 0;
  opacity: 1;
  pointer-events: auto;
}

.smart-banner__tab.visible:hover {
  transform: translateY(-50%) translateX(5px);
  background: var(--card-hover-bg);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.smart-banner__tab-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.875rem;
  font-weight: 600;
  color: #00d4ff;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.smart-banner__tab-icon {
  font-size: 1.5rem;
  color: #8b7fd8;
  filter: drop-shadow(0 2px 6px rgba(139, 127, 216, 0.5));
  display: flex;
  align-items: center;
  justify-content: center;
}

.smart-banner__tab-icon i {
  display: flex;
  align-items: center;
  justify-content: center;
}

.smart-banner__tab-icon i::before {
  margin: 0 !important;
  padding: 0 !important;
}

/* ============================================
   RESPONSIVE: MOBILE & TABLET
   ============================================ */

@media (max-width: 768px) {
  .smart-banner {
    /* On mobile, show at bottom */
    top: auto;
    bottom: -500px;
    right: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 1.5rem 1.5rem 0 0;
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-bottom: none;
    transition: bottom 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .smart-banner.visible {
    bottom: 0;
    animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .smart-banner.dismissed {
    bottom: -500px;
    left: auto;
  }

  @keyframes slideInFromBottom {
    from {
      bottom: -500px;
      opacity: 0;
    }
    to {
      bottom: 0;
      opacity: 1;
    }
  }

  .smart-banner__content {
    padding: 1.5rem 1.25rem 2rem 1.25rem;
  }

  .smart-banner__thumbnail {
    padding: 0.875rem;
  }

  .smart-banner__icon {
    width: 48px;
    height: 48px;
  }

  .smart-banner__icon svg {
    width: 28px;
    height: 28px;
  }

  /* Form adjustments for mobile bottom sheet */
  .smart-banner__input-group {
    flex-direction: column;
  }

  .smart-banner__submit {
    width: 100%;
    padding: 0.875rem;
  }

  .smart-banner__success-phase {
    padding: 1.5rem 1.25rem 2rem;
  }

  /* Transform tab to floating button on mobile */
  .smart-banner__tab {
    left: 16px;
    bottom: 16px;
    top: auto;
    transform: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg-modern);
    border: 1px solid var(--card-border-modern);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
  }

  .smart-banner__tab.visible {
    left: 16px;
    opacity: 1;
    pointer-events: auto;
    animation: fadeInScale 0.3s ease-out forwards;
  }

  .smart-banner__tab.visible:active {
    transform: scale(0.95);
  }

  .smart-banner__tab-text {
    display: none; /* Hide text on mobile */
  }

  .smart-banner__tab-icon {
    font-size: 1.25rem;
    margin: 0;
  }

  @keyframes fadeInScale {
    from {
      opacity: 0;
      transform: scale(0.8);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
  .smart-banner {
    width: 320px;
  }
}

/* Accessibility: Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .smart-banner,
  .smart-banner__close,
  .smart-banner__cta,
  .smart-banner__tab {
    transition: none;
    animation: none;
  }

  .smart-banner__icon {
    animation: none;
  }

  .smart-banner__submit-loader {
    animation: none;
  }

  .smart-banner__success-icon {
    animation: none;
  }

  .smart-banner__success-phase {
    animation: none;
  }
}
