/* Enhanced Popup CSS with Full Customization Support */

/* Base variables - will be overridden by dynamic CSS */
:root {
  --bmlp-bg-color: #ffffff;
  --bmlp-overlay-color: rgba(0,0,0,0.5);
  --bmlp-primary-color: #222222;
  --bmlp-secondary-color: #666666;
  --bmlp-accent-color: #ff8356;
  --bmlp-text-color: #333333;
  --bmlp-input-bg: #ffffff;
  --bmlp-input-border: #d0d0d0;
  --bmlp-button-text-color: #ffffff;
  --bmlp-font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --bmlp-heading-size: 28px;
  --bmlp-subtext-size: 14px;
  --bmlp-button-size: 14px;
  --bmlp-heading-weight: 800;
  --bmlp-button-weight: 700;
  --bmlp-text-align: center;
  --bmlp-letter-spacing: 0px;
  --bmlp-popup-width: 420px;
  --bmlp-popup-padding: 28px;
  --bmlp-border-radius: 12px;
  --bmlp-input-padding: 12px;
  --bmlp-button-padding: 12px;
  --bmlp-element-spacing: 16px;
  --bmlp-border-width: 0px;
  --bmlp-border-color: #e0e0e0;
  --bmlp-shadow: 0 10px 30px rgba(0,0,0,0.2);
  --bmlp-animation-duration: 300ms;
  --bmlp-animation-easing: ease-out;
}

/* Enhanced overlay with smooth transitions */
.bmlp-overlay.bmlp-enhanced {
  position: fixed;
  inset: 0;
  background: var(--bmlp-overlay-color);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--bmlp-animation-duration) var(--bmlp-animation-easing),
              visibility var(--bmlp-animation-duration) var(--bmlp-animation-easing);
}

.bmlp-overlay.bmlp-enhanced.show {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Enhanced wrapper with improved responsiveness */
.bmlp-enhanced .bmlp-wrapper {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--bmlp-animation-duration) var(--bmlp-animation-easing),
              transform var(--bmlp-animation-duration) var(--bmlp-animation-easing);
}

.bmlp-overlay.show .bmlp-wrapper {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced modal styling */
.bmlp-enhanced .bmlp-modal {
  background: var(--bmlp-bg-color);
  border-radius: var(--bmlp-border-radius);
  max-width: var(--bmlp-popup-width);
  width: min(90vw, var(--bmlp-popup-width));
  padding: 0;
  box-shadow: var(--bmlp-shadow);
  text-align: var(--bmlp-text-align);
  position: relative;
  font-family: var(--bmlp-font-family);
  overflow: hidden;
  border: var(--bmlp-border-width) solid var(--bmlp-border-color);
}

/* Enhanced sticky mode */
.bmlp-enhanced .bmlp-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bmlp-bg-color);
  border-top-left-radius: var(--bmlp-border-radius);
  border-top-right-radius: var(--bmlp-border-radius);
  box-shadow: var(--bmlp-shadow);
  padding: calc(var(--bmlp-popup-padding) * 0.6);
  max-width: none;
  width: 100%;
  margin: 0 auto;
  text-align: var(--bmlp-text-align);
  font-family: var(--bmlp-font-family);
  border: var(--bmlp-border-width) solid var(--bmlp-border-color);
  border-bottom: none;
  transform: translateY(100%);
  transition: transform var(--bmlp-animation-duration) var(--bmlp-animation-easing);
}

.bmlp-overlay.show .bmlp-sticky {
  transform: translateY(0);
}

/* Enhanced content layout */
.bmlp-enhanced .bmlp-content {
  padding: var(--bmlp-popup-padding);
}

.bmlp-enhanced .bmlp-sticky .bmlp-content {
  display: flex;
  gap: calc(var(--bmlp-element-spacing) * 0.5);
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

/* Enhanced typography */
.bmlp-enhanced .bmlp-title {
  font-size: var(--bmlp-heading-size);
  font-weight: var(--bmlp-heading-weight);
  color: var(--bmlp-primary-color);
  letter-spacing: var(--bmlp-letter-spacing);
  margin: 0 0 var(--bmlp-element-spacing) 0;
  line-height: 1.2;
}

.bmlp-enhanced .bmlp-subtext {
  color: var(--bmlp-text-color);
  font-size: var(--bmlp-subtext-size);
  margin: 0 0 var(--bmlp-element-spacing) 0;
  line-height: 1.4;
}

.bmlp-enhanced .bmlp-sticky .bmlp-title {
  font-size: calc(var(--bmlp-heading-size) * 0.6);
  margin: 0;
}

.bmlp-enhanced .bmlp-sticky .bmlp-subtext {
  margin: 0;
  font-size: calc(var(--bmlp-subtext-size) * 0.9);
  opacity: 0.8;
}

/* Enhanced form styling */
.bmlp-enhanced .bmlp-enhanced-form {
  margin: var(--bmlp-element-spacing) 0;
}

.bmlp-enhanced .bmlp-input {
  width: 100%;
  padding: var(--bmlp-input-padding);
  border: 2px solid var(--bmlp-input-border);
  border-radius: calc(var(--bmlp-border-radius) * 0.5);
  font-size: var(--bmlp-subtext-size);
  outline: none;
  background: var(--bmlp-input-bg);
  color: #000000 !important;
  font-weight: bold !important;
  font-family: var(--bmlp-font-family);
  margin-bottom: calc(var(--bmlp-element-spacing) * 0.5);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.bmlp-enhanced .bmlp-input:focus {
  border-color: var(--bmlp-accent-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.bmlp-enhanced .bmlp-input::placeholder {
  color: var(--bmlp-secondary-color);
}

/* Enhanced button styling */
.bmlp-enhanced .bmlp-btn {
  width: 100%;
  padding: var(--bmlp-button-padding);
  border: none;
  border-radius: calc(var(--bmlp-border-radius) * 0.5);
  background: var(--bmlp-accent-color);
  color: var(--bmlp-button-text-color);
  font-weight: var(--bmlp-button-weight);
  font-size: var(--bmlp-button-size);
  cursor: pointer;
  font-family: var(--bmlp-font-family);
  transition: all 0.2s ease;
  margin-top: calc(var(--bmlp-element-spacing) * 0.5);
  position: relative;
  overflow: hidden;
}

.bmlp-enhanced .bmlp-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.bmlp-enhanced .bmlp-btn:active {
  transform: translateY(0);
}

.bmlp-enhanced .bmlp-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Enhanced skip button */
.bmlp-enhanced .bmlp-skip {
  margin-top: calc(var(--bmlp-element-spacing) * 0.75);
  display: inline-block;
  background: none;
  border: none;
  color: var(--bmlp-secondary-color);
  opacity: 0.8;
  font-weight: var(--bmlp-button-weight);
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: var(--bmlp-font-family);
  font-size: calc(var(--bmlp-subtext-size) * 0.9);
  transition: all 0.2s ease;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.bmlp-enhanced .bmlp-skip:hover {
  opacity: 1;
  color: var(--bmlp-primary-color);
}

/* Enhanced close button */
.bmlp-enhanced .bmlp-close {
  position: absolute;
  right: calc(var(--bmlp-popup-padding) * 0.5);
  top: calc(var(--bmlp-popup-padding) * 0.5);
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--bmlp-secondary-color);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.bmlp-enhanced .bmlp-close:hover {
  background: rgba(0,0,0,0.1);
  color: var(--bmlp-primary-color);
  transform: scale(1.1);
}

/* Enhanced photo card style */
.bmlp-enhanced .bmlp-photo {
  position: relative;
  min-height: 420px;
  background-image: var(--bmlp-bg, none);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  background-color: var(--bmlp-bg-color);
}

.bmlp-enhanced .bmlp-photo:before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  pointer-events: none;
  border-radius: inherit;
}

.bmlp-enhanced .bmlp-photo .bmlp-content {
  position: relative;
  z-index: 1;
  width: 100%;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--bmlp-border-radius) var(--bmlp-border-radius) 0 0;
}

.bmlp-enhanced .bmlp-photo .bmlp-title {
  font-size: calc(var(--bmlp-heading-size) * 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Enhanced sticky mode specific styles */
.bmlp-enhanced .bmlp-sticky .bmlp-input {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.bmlp-enhanced .bmlp-sticky .bmlp-btn {
  white-space: nowrap;
  width: auto;
  padding: var(--bmlp-input-padding) calc(var(--bmlp-input-padding) * 1.5);
  margin-top: 0;
}

.bmlp-enhanced .bmlp-sticky .bmlp-skip {
  margin-top: 0;
  margin-left: auto;
}

.bmlp-enhanced .bmlp-sticky .bmlp-close {
  position: absolute;
  right: 10px;
  top: 6px;
}

/* Enhanced message styling */
.bmlp-enhanced .bmlp-message {
  margin-top: calc(var(--bmlp-element-spacing) * 0.5);
  padding: 8px 12px;
  border-radius: calc(var(--bmlp-border-radius) * 0.5);
  font-size: calc(var(--bmlp-subtext-size) * 0.9);
  text-align: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
}

.bmlp-enhanced .bmlp-message:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

.bmlp-enhanced .bmlp-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.bmlp-enhanced .bmlp-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Enhanced GDPR checkbox */
.bmlp-enhanced .bmlp-gdpr-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: calc(var(--bmlp-element-spacing) * 0.75) 0;
  font-size: calc(var(--bmlp-subtext-size) * 0.85);
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
}

.bmlp-enhanced .bmlp-gdpr-checkbox input[type="checkbox"] {
  margin: 0;
  min-width: 16px;
  margin-top: 2px;
  accent-color: var(--bmlp-accent-color);
}

.bmlp-enhanced .bmlp-gdpr-text {
  color: var(--bmlp-secondary-color);
}

/* Enhanced OTP verification */
.bmlp-enhanced .bmlp-otp-wrap {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: var(--bmlp-element-spacing);
  padding: var(--bmlp-popup-padding);
  background: rgba(0,0,0,0.02);
  border-radius: calc(var(--bmlp-border-radius) * 0.5);
  border: 1px dashed var(--bmlp-input-border);
  animation: slideInUp 0.3s ease;
}

.bmlp-enhanced .bmlp-otp {
  padding: var(--bmlp-input-padding);
  border: 2px solid var(--bmlp-input-border);
  border-radius: calc(var(--bmlp-border-radius) * 0.5);
  max-width: 140px;
  text-align: center;
  font-size: calc(var(--bmlp-subtext-size) * 1.1);
  letter-spacing: 2px;
  font-family: var(--bmlp-font-family);
  background: var(--bmlp-input-bg);
  transition: all 0.2s ease;
}

.bmlp-enhanced .bmlp-otp:focus {
  border-color: var(--bmlp-accent-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.bmlp-enhanced .bmlp-otp-verify {
  padding: var(--bmlp-input-padding) calc(var(--bmlp-input-padding) * 1.2);
  border: none;
  border-radius: calc(var(--bmlp-border-radius) * 0.5);
  background: var(--bmlp-accent-color);
  color: var(--bmlp-button-text-color);
  font-weight: var(--bmlp-button-weight);
  cursor: pointer;
  font-family: var(--bmlp-font-family);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bmlp-enhanced .bmlp-otp-verify:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Enhanced animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animation classes */
.bmlp-enhanced .bmlp-wrapper.animate-fade {
  animation: fadeInScale var(--bmlp-animation-duration) var(--bmlp-animation-easing);
}

.bmlp-enhanced .bmlp-wrapper.animate-slide {
  animation: slideInUp var(--bmlp-animation-duration) var(--bmlp-animation-easing);
}

.bmlp-enhanced .bmlp-wrapper.animate-bounce {
  animation: bounceIn calc(var(--bmlp-animation-duration) * 1.5) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Enhanced responsive design */
@media (max-width: 640px) {
  .bmlp-enhanced .bmlp-modal {
    width: 100%;
    max-width: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--bmlp-border-radius);
    border-top-right-radius: var(--bmlp-border-radius);
    margin-top: auto;
  }
  
  .bmlp-enhanced .bmlp-sticky .bmlp-content {
    flex-direction: column;
    align-items: stretch;
    gap: calc(var(--bmlp-element-spacing) * 0.5);
  }
  
  .bmlp-enhanced .bmlp-sticky .bmlp-input {
    min-width: auto;
  }
  
  .bmlp-enhanced .bmlp-btn {
    width: 100%;
  }
  
  .bmlp-enhanced .bmlp-otp-wrap {
    flex-direction: column;
    gap: 10px;
  }
  
  .bmlp-enhanced .bmlp-otp {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .bmlp-enhanced .bmlp-content {
    padding: calc(var(--bmlp-popup-padding) * 0.8);
  }
  
  .bmlp-enhanced .bmlp-title {
    font-size: calc(var(--bmlp-heading-size) * 0.8);
  }
  
  .bmlp-enhanced .bmlp-subtext {
    font-size: calc(var(--bmlp-subtext-size) * 0.9);
  }
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
  .bmlp-enhanced .bmlp-overlay,
  .bmlp-enhanced .bmlp-wrapper,
  .bmlp-enhanced .bmlp-input,
  .bmlp-enhanced .bmlp-btn,
  .bmlp-enhanced .bmlp-close,
  .bmlp-enhanced .bmlp-message {
    transition: none;
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bmlp-enhanced .bmlp-input,
  .bmlp-enhanced .bmlp-btn {
    border-width: 2px;
  }
  
  .bmlp-enhanced .bmlp-close {
    border: 2px solid;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .bmlp-enhanced .bmlp-modal:not(.custom-colors) {
    --bmlp-bg-color: #2d3748;
    --bmlp-primary-color: #ffffff;
    --bmlp-text-color: #e2e8f0;
    --bmlp-secondary-color: #a0aec0;
    --bmlp-input-bg: #4a5568;
    --bmlp-input-border: #6b7280;
  }
}

/* Focus management for accessibility */
.bmlp-enhanced .bmlp-input:focus,
.bmlp-enhanced .bmlp-btn:focus,
.bmlp-enhanced .bmlp-skip:focus,
.bmlp-enhanced .bmlp-close:focus,
.bmlp-enhanced .bmlp-gdpr-checkbox input:focus {
  outline: 2px solid var(--bmlp-accent-color);
  outline-offset: 2px;
}

/* Loading states */
.bmlp-enhanced .bmlp-btn.loading {
  position: relative;
  color: transparent;
}

.bmlp-enhanced .bmlp-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
  .bmlp-enhanced .bmlp-overlay {
    display: none !important;
  }
}
