/* 
 * AI Visibility Modal Styles
 * Wersja: 1.0.0
 */

/* Modal Backdrop */
.ai-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  opacity: 0;
  padding: max(1rem, env(safe-area-inset-top)) 
           max(1rem, env(safe-area-inset-right)) 
           max(1rem, env(safe-area-inset-bottom)) 
           max(1rem, env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;  /* Safari uwzględnia paski */
  animation: aiModalFadeIn 0.3s ease forwards;
}

/* Modal Container */
.ai-modal {
  background: #fff;
  border-radius: 24px;
  max-width: 1060px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5),
    0 25px 50px -12px rgba(0, 0, 0, 0.15);
  
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
  overflow-y: auto;
  
  transform: scale(0.95) translateY(20px);
  animation: aiModalSlideIn 0.4s ease 0.1s forwards;
}

/* Animations */
@keyframes aiModalFadeIn {
  to {
    opacity: 1;
  }
}

@keyframes aiModalSlideIn {
  to {
    transform: scale(1) translateY(0);
  }
}

@keyframes aiModalShimmer {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(10%, 10%);
  }
}

@keyframes aiModalBarGrow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes aiModalPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes aiModalSlideItem {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes aiModalFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Left Side - Graphic */
.ai-modal-graphic {
  background: linear-gradient(145deg, #a78bfa 0%, #7c3aed 50%, #5b21b6 100%);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.ai-modal-graphic::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 50%
  );
  animation: aiModalShimmer 8s ease-in-out infinite;
}

.ai-modal-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.1) 1px,
    transparent 1px
  );
  background-size: 20px 20px;
  pointer-events: none;
}

/* Document Mockup */
.ai-modal-doc {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 240px;
  padding: 1.25rem;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: rotate(-3deg);
  transition: transform 0.3s ease;
}

.ai-modal-graphic:hover .ai-modal-doc {
  transform: rotate(0deg) scale(1.02);
}

.ai-modal-doc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.ai-modal-doc-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-modal-doc-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: #1f2937;
}

.ai-modal-doc-subtitle {
  font-size: 0.55rem;
  color: #9ca3af;
}

/* Chart */
.ai-modal-chart {
  height: 80px;
  background: linear-gradient(to top, rgba(124, 58, 237, 0.08), transparent);
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0.5rem;
  gap: 0.25rem;
}

.ai-modal-bar {
  width: 20px;
  background: linear-gradient(to top, #5b21b6, #a78bfa);
  border-radius: 4px 4px 0 0;
  animation: aiModalBarGrow 1s ease forwards;
  transform-origin: bottom;
}

.ai-modal-bar:nth-child(1) {
  height: 45%;
  animation-delay: 0.2s;
}
.ai-modal-bar:nth-child(2) {
  height: 70%;
  animation-delay: 0.3s;
}
.ai-modal-bar:nth-child(3) {
  height: 55%;
  animation-delay: 0.4s;
}
.ai-modal-bar:nth-child(4) {
  height: 85%;
  animation-delay: 0.5s;
}
.ai-modal-bar:nth-child(5) {
  height: 65%;
  animation-delay: 0.6s;
}

/* Lines */
.ai-modal-lines {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ai-modal-line {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
}

.ai-modal-line:nth-child(1) {
  width: 100%;
}
.ai-modal-line:nth-child(2) {
  width: 85%;
}
.ai-modal-line:nth-child(3) {
  width: 60%;
}

/* Score Badge */
.ai-modal-score {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: #fff;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 2;
  animation: aiModalPulse 2s ease-in-out infinite;
}

.ai-modal-score-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: #5b21b6;
  line-height: 1;
}

.ai-modal-score-lbl {
  font-size: 0.55rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Floating Badges */
.ai-modal-badge {
  position: absolute;
  background: rgba(255, 255, 255, 0.98);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #5b21b6;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  z-index: 2;
  animation: aiModalFloat 3s ease-in-out infinite;
  border: 1px solid rgba(124, 58, 237, 0.1);
}

.ai-modal-badge-1 {
  bottom: 2rem;
  left: 1rem;
  animation-delay: 0.5s;
}

.ai-modal-badge-2 {
  bottom: 4rem;
  right: 0.5rem;
  animation-delay: 1s;
}

/* Right Side - Content */
.ai-modal-content {
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow-y: auto;
}

/* Close Button */
.ai-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #64748b;
}

.ai-modal-close:hover {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.ai-modal-close svg {
  width: 18px;
  height: 18px;
}

/* Tag */
.ai-modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(124, 58, 237, 0.1);
  color: #5b21b6;
  padding: 0.4rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
  width: fit-content;
}

.ai-modal-tag svg {
  width: 14px;
  height: 14px;
}

/* Title & Subtitle */
#ai-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  margin: 0 0 0.5rem 0;
}

.ai-modal-subtitle {
  color: #64748b;
  font-size: 0.875rem;
  margin: 0 0 1.125rem 0;
  line-height: 1.5;
}

/* Feature List */
.ai-modal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ai-modal-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: #374151;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(-10px);
  animation: aiModalSlideItem 0.4s ease forwards;
}

.ai-modal-list li:nth-child(1) {
  animation-delay: 0.3s;
}
.ai-modal-list li:nth-child(2) {
  animation-delay: 0.4s;
}
.ai-modal-list li:nth-child(3) {
  animation-delay: 0.5s;
}
.ai-modal-list li:nth-child(4) {
  animation-delay: 0.6s;
}

/* Icon */
.ai-modal-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.ai-modal-icon svg {
  width: 12px;
  height: 12px;
  color: #fff;
}

/* CTA Button */
.ai-modal-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.ai-modal-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-modal-btn:hover::before {
  opacity: 1;
}

.ai-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.ai-modal-btn:active {
  transform: translateY(0);
}

.ai-modal-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ai-modal-btn span,
.ai-modal-btn svg {
  position: relative;
  z-index: 1;
}

.ai-modal-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.ai-modal-btn:hover svg {
  transform: translateX(4px);
}

/* Responsive */
@media (max-width: 768px) {
  .ai-modal {
    grid-template-columns: 1fr;
    max-width: calc(100vw - 2rem);
    width: 100%;
    box-sizing: border-box;
  }

  .ai-modal-backdrop {
    padding: 1rem;
    align-items: flex-end;
  }

  .ai-modal-graphic {
    padding: 2rem;
    min-height: 220px;
  }

  .ai-modal-doc {
    max-width: 180px;
  }

  .ai-modal-score {
    width: 55px;
    height: 55px;
    top: 1rem;
    right: 1rem;
  }

  .ai-modal-score-val {
    font-size: 1.2rem;
  }

  .ai-modal-badge {
    display: none;
  }

  .ai-modal-content {
    padding: 1.75rem;
  }

  #ai-modal-title {
    font-size: 1.4rem;
  }

  .ai-modal-close {
    top: 1rem;
    right: 1rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Loader animation for button */
.ai-modal-btn-loader svg {
  width: 18px;
  height: 18px;
  animation: aiModalSpin 0.8s linear infinite;
}

@keyframes aiModalSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ai-modal-btn-text,
.ai-modal-btn-loader {
  position: relative;
  z-index: 1;
}

/* Hide arrow when loading */
.ai-modal-btn.loading .ai-modal-btn-arrow {
  display: none;
}

/* CTA Button (teraz link) */
.ai-modal-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
  text-decoration: none; /* dla linka */
}

.ai-modal-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-modal-btn:hover::before {
  opacity: 1;
}

.ai-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
  color: #fff; /* zachowaj biały kolor przy hover */
}

.ai-modal-btn:active {
  transform: translateY(0);
}

.ai-modal-btn span,
.ai-modal-btn svg {
  position: relative;
  z-index: 1;
}

.ai-modal-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.ai-modal-btn:hover svg {
  transform: translateX(4px);
}
