/* Portfolio Modal Styles
   Matching Service Modal Design
   ============================================== */

/* Portfolio Modal (main class used by renderer) */
.portfolio-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  overflow-y: auto;
}

.portfolio-modal.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Overlay - Updated class name to match renderer */
.modal-overlay,
.portfolio-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
}

/* Modal Content - Support both class names */
.modal-content,
.portfolio-modal-container {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 40px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.portfolio-modal.active .modal-content,
.portfolio-modal.active .portfolio-modal-container {
  transform: scale(1) translateY(0);
}

/* Modal Close Button (X in top-right corner) */
.portfolio-modal .modal-close,
.portfolio-modal button.modal-close,
.service-modal .modal-close,
.service-modal button.modal-close {
  position: absolute !important;
  top: 20px;
  right: 20px;
  background: white !important;
  border: 1px solid #e5e7eb !important;
  color: #6b7280;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1;
  z-index: 10001 !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 24px;
  visibility: visible !important;
  opacity: 1 !important;
}

.portfolio-modal .modal-close:hover,
.portfolio-modal button.modal-close:hover,
.service-modal .modal-close:hover,
.service-modal button.modal-close:hover {
  background: #f3f4f6;
  color: #111827;
  transform: rotate(90deg);
}

.portfolio-modal .modal-close svg,
.portfolio-modal button.modal-close svg,
.service-modal .modal-close svg,
.service-modal button.modal-close svg {
  fill: #6b7280 !important;
  transition: fill 0.2s ease;
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  max-width: none !important;
  min-width: 20px !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

.portfolio-modal .modal-close:hover svg,
.portfolio-modal button.modal-close:hover svg,
.service-modal .modal-close:hover svg,
.service-modal button.modal-close:hover svg {
  fill: #111827 !important;
}

.portfolio-modal .modal-close svg path {
  fill: currentColor !important;
}

/* Modal Header */
.modal-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-badge {
  display: inline-block;
  background: #f59e0b;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-title {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 12px 0;
  line-height: 1.2;
}

.modal-subtitle,
.modal-client {
  font-size: 18px;
  color: #4b5563;
  margin: 0;
  line-height: 1.6;
}

/* Modal Body */
.modal-body {
  padding: 0 40px;
  margin: 0 -40px;
}

.modal-section {
  margin-bottom: 40px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h3 {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 20px 0;
}

.section-icon {
  font-size: 1.5rem;
  color: #6366f1;
  margin-right: 8px;
}

.modal-section p {
  font-size: 16px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

/* Modal Hero Image */
.modal-hero {
  margin: -40px -40px 32px -40px;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.modal-hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* Challenge & Solution Content */
.challenge-content,
.solution-content {
  padding: 24px;
  border-radius: 12px;
  line-height: 1.6;
}

.challenge-content {
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
  border: 1px solid #fecaca;
}

.solution-content {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1px solid #bbf7d0;
}

.challenge-content ul,
.solution-content ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.challenge-content li,
.solution-content li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 12px;
  color: #374151;
  font-size: 15px;
  line-height: 1.6;
}

.challenge-content li::before {
  content: '⚠️';
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 18px;
}

.solution-content li::before {
  content: '✅';
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 18px;
}

/* Results Grid & List */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.result-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.result-card:hover {
  border-color: #6366f1;
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.1);
  transform: translateY(-4px);
}

.result-card.highlight {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border: none;
  transform: scale(1.05);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
}

.result-value {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: #111827;
  letter-spacing: -0.02em;
  line-height: 1;
}

.result-card.highlight .result-value {
  color: white;
}

.result-label {
  font-size: 0.875rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.result-card.highlight .result-label {
  color: rgba(255, 255, 255, 0.9);
}

.result-previous {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.result-card.highlight .result-previous {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Results List (Legacy) */
.results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.results-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  color: #4b5563;
  line-height: 1.6;
  font-size: 16px;
}

.results-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #10b981;
  font-weight: bold;
  font-size: 1.2rem;
}

/* Tech Stack Grid */
.tech-stack-grid,
.modal-tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.tech-badge {
  display: inline-flex;
  align-items: center;
  background: #f3f4f6;
  color: #374151;
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.tech-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  transition: left 0.3s ease;
  z-index: 0;
}

.tech-badge:hover {
  color: white;
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.2);
}

.tech-badge:hover::before {
  left: 0;
}

/* Features List */
.features-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}

.features-list li {
  position: relative;
  padding: 12px 12px 12px 36px;
  margin-bottom: 12px;
  background: #f9fafb;
  border-radius: 8px;
  color: #374151;
  line-height: 1.6;
  font-size: 16px;
  transition: all 0.2s ease;
}

.features-list li:hover {
  background: #f3f4f6;
  transform: translateX(4px);
}

.features-list li::before {
  content: '✨';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

/* Client Testimonial */
.testimonial-section,
.modal-testimonial {
  background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
  position: relative;
}

.testimonial-section::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 20px;
  font-size: 60px;
  color: #f59e0b;
  opacity: 0.3;
  font-family: Georgia, serif;
  line-height: 1;
}

.client-testimonial {
  margin: 0;
  position: relative;
}

.client-testimonial p,
.modal-testimonial blockquote {
  font-size: 18px;
  line-height: 1.6;
  color: #78350f;
  font-style: italic;
  margin: 0 0 20px 0;
  position: relative;
  z-index: 1;
}

.modal-testimonial blockquote {
  position: relative;
  padding-left: 24px;
}

.modal-testimonial blockquote::before {
  content: '"';
  position: absolute;
  left: 0;
  top: -10px;
  font-size: 3rem;
  color: #f59e0b;
  opacity: 0.3;
}

.client-testimonial footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.testimonial-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.testimonial-name {
  font-weight: 600;
  color: #92400e;
  margin-bottom: 4px;
  font-size: 16px;
}

.testimonial-title {
  font-size: 14px;
  color: #b45309;
}

/* Screenshots Grid */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.screenshot {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
}

.screenshot:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #6366f1;
}

/* Related Projects */
.related-section {
  border-top: 1px solid #e5e7eb;
  padding: 32px 40px 0 40px;
  margin: 48px -40px 0 -40px;
}

.related-section h3 {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 20px 0;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

button.related-card,
.related-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  box-sizing: border-box;
}

/* Reset button styles specifically for related cards */
button.related-card::-moz-focus-inner {
  border: 0;
  padding: 0;
}

button.related-card {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.related-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.related-card:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}

.related-card:hover::before {
  transform: scaleX(1);
}

/* Related card content wrapper */
.related-card-content {
  padding: 20px 20px 16px 20px;
  flex: 1;
}

.related-card h4 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
  padding: 0;
  text-align: left;
}

.related-card p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
  padding: 0;
  text-align: left;
}

/* Related card footer */
.related-card-footer {
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
  background: #fafbfc;
}

.related-link {
  color: #6366f1;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap 0.3s ease;
}

.related-card:hover .related-link {
  gap: 12px;
}

/* Modal Footer */
.modal-footer {
  padding: 32px 40px 0 40px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 40px -40px 0 -40px;
}

/* Remove btn-primary and btn-secondary since we're using cta classes */
.modal-footer .cta-primary,
.modal-footer .cta-secondary {
  /* These will inherit from the main cta styles in custom.css */
  /* Just add modal-specific overrides */
  margin: 0;
}

/* Modal-specific CTA primary overrides if needed */
.modal-footer .cta-primary {
  /* Inherits from main styles */
}

/* Modal footer button overrides */
.modal-footer .modal-close-btn {
  /* Inherits from cta-secondary - no special styling needed */
  position: static; /* Override any absolute positioning */
}

/* Scrollbar Styling */
.modal-content::-webkit-scrollbar,
.portfolio-modal-container::-webkit-scrollbar {
  width: 10px;
}

.modal-content::-webkit-scrollbar-track,
.portfolio-modal-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 5px;
}

.modal-content::-webkit-scrollbar-thumb,
.portfolio-modal-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
  border: 2px solid #f1f5f9;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.portfolio-modal-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-content,
  .portfolio-modal-container {
    padding: 24px;
    max-height: 100vh;
    border-radius: 0;
    width: 100%;
    margin: 0;
  }
  
  .modal-header {
    margin-bottom: 24px;
  }
  
  .modal-title {
    font-size: 24px;
  }
  
  .modal-subtitle {
    font-size: 16px;
  }
  
  .modal-body {
    padding: 0 24px;
    margin: 0 -24px;
  }
  
  .modal-hero {
    margin: -24px -24px 24px -24px;
  }
  
  .testimonial-section,
  .modal-testimonial {
    margin: 24px -24px;
    padding: 20px 24px;
  }
  
  .modal-footer {
    padding: 24px;
    margin: 24px -24px 0 -24px;
    flex-direction: column;
    gap: 12px;
  }
  
  .modal-footer .cta-primary,
  .modal-footer .cta-secondary {
    width: 100%;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .screenshots-grid {
    grid-template-columns: 1fr;
  }
  
  .related-grid {
    grid-template-columns: 1fr;
  }
  
  .portfolio-modal .modal-close,
  .portfolio-modal button.modal-close {
    top: 12px;
    right: 12px;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    font-size: 20px;
  }
}

/* Animation Classes */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.portfolio-modal.active .modal-content {
  animation: modalFadeIn 0.3s ease forwards;
}