/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #06b6d4;
  --accent-color: #8b5cf6;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #475569;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

body.dark-mode {
  background: #0f172a;
  color: var(--text-primary);
}
body.dark-mode .navbar {
  background: rgba(15, 23, 42, 0.98);
  border-bottom: 1px solid var(--border-color);
}
body.dark-mode .nav-link {
  color: var(--text-secondary);
}
body.dark-mode .nav-link:hover {
  color: var(--primary-color);
}
body.dark-mode .hero {
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
}
body.dark-mode .category-card,
body.dark-mode .template-card,
body.dark-mode .modal-content,
body.dark-mode .content-card {
  background: rgba(30, 41, 59, 0.92);
  color: var(--text-primary);
}
body.dark-mode .footer {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
body.dark-mode .footer-section h3,
body.dark-mode .footer-section p,
body.dark-mode .footer-section ul li a {
  color: var(--text-primary);
}
body.dark-mode .btn,
body.dark-mode .btn-secondary,
body.dark-mode .btn-primary {
  color: #fff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 3.5rem;
}
h2 {
  font-size: 2.5rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: var(--transition);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.nav-logo h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.nav-logo span {
  color: var(--primary-color);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: var(--transition);
}

.nav-link:hover::after {
  width: 100%;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

.bar {
  width: 25px;
  height: 3px;
  background: var(--text-primary);
  margin: 3px 0;
  transition: var(--transition);
}

/* Hero Section */
.hero {
  padding: 120px 0 80px;
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23475569" stroke-width="0.5" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.1;
}

.hero-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
}

/* Categories Section */
.categories {
  padding: 80px 0;
  background: var(--bg-secondary);
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.section-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.category-card {
  background: rgba(30, 41, 59, 0.85);
  padding: 2.5rem;
  border-radius: var(--border-radius-xl);
  text-align: center;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 8px 32px 0 rgba(99, 102, 241, 0.18);
  border: 1.5px solid var(--primary-color);
}

.category-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.category-icon i {
  font-size: 2rem;
  color: var(--text-primary);
}

.category-card h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  position: relative;
}

.category-card h3::after {
  content: "";
  display: block;
  width: 0;
  height: 3px;
  background: var(--primary-color);
  transition: width 0.3s;
  border-radius: 2px;
  margin-top: 4px;
}

.category-card:hover h3::after {
  width: 100%;
}

.category-card p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.category-count {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Templates Section */
.templates {
  padding: 80px 0;
  background: var(--bg-primary);
}

.filter-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 12px 24px;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--text-primary);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.template-card {
  background: rgba(30, 41, 59, 0.85);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.template-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.22);
  border: 1.5px solid var(--accent-color);
}

.price-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 2;
}

.template-preview {
  position: relative;
  height: 200px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Ensure images are visible and properly sized */
.template-preview img:not([style*="display: none"]) {
  opacity: 1;
  visibility: visible;
}

.template-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.template-placeholder i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* --- Modern, animated, responsive Buy/Preview buttons for template overlay --- */
.template-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  opacity: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity 0.3s;
  z-index: 1;
  pointer-events: none;
}
.template-card:hover .template-overlay {
  opacity: 1;
  pointer-events: auto;
}
.template-overlay a.btn {
  min-width: 120px;
  padding: 0.8rem 1.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.08rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 16px 0 rgba(99, 102, 241, 0.13),
    0 1.5px 8px 0 rgba(0, 0, 0, 0.1);
  transition: background 0.22s, color 0.22s, box-shadow 0.22s, transform 0.18s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  position: relative;
  overflow: hidden;
}
.template-overlay a.btn-primary {
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  color: #fff;
  border: 2.5px solid transparent;
  box-shadow: 0 0 16px 0 var(--primary-color), 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.template-overlay a.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--primary-color);
  border: 2.5px solid var(--primary-color);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.template-overlay a.btn:hover {
  transform: scale(1.07) translateY(-2px);
  box-shadow: 0 4px 32px 0 var(--accent-color), 0 2px 12px 0 rgba(0, 0, 0, 0.13);
  filter: brightness(1.08);
}
.template-overlay a.btn:active::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 120%;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  animation: ripple 0.5s linear;
  pointer-events: none;
}
@keyframes ripple {
  from {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(0.7);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}
@media (max-width: 600px) {
  .template-overlay {
    flex-direction: column;
    gap: 0.7rem;
  }
  .template-overlay a.btn {
    width: 90%;
    justify-content: center;
    font-size: 1.08rem;
    padding: 1.1rem 0;
  }
}
/* Remove old .buy-btn/.view-btn rules if not needed */
.buy-btn,
.view-btn {
  display: none !important;
}

.tag-pill {
  display: inline-block;
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-color);
  border-radius: 999px;
  padding: 0.2rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  margin-right: 0.4rem;
  margin-bottom: 0.2rem;
}

.template-info {
  padding: 1.5rem;
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.template-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
}

.template-category {
  background: var(--primary-color);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.template-info p {
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Show only 3 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.template-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.template-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.template-date {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  padding: 3rem 0 1rem;
  border-top: 1px solid var(--border-color);
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-section h3 span {
  color: var(--primary-color);
}

.footer-section p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-section ul li a:hover {
  color: var(--primary-color);
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.social-links a:hover {
  background: var(--primary-color);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  text-align: center;
}

.footer-bottom p {
  color: var(--text-muted);
  margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: 70px;
    flex-direction: column;
    background-color: var(--bg-secondary);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    box-shadow: var(--shadow-lg);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu.active {
    left: 0;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-stats {
    gap: 2rem;
  }

  .templates-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .filter-container {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 1rem;
  }

  .filter-btn {
    white-space: nowrap;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }

  h1 {
    font-size: 2.5rem;
  }
  h2 {
    font-size: 2rem;
  }
  h3 {
    font-size: 1.5rem;
  }
  h4 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .hero {
    padding: 100px 0 60px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
  }

  .template-preview {
    height: 200px;
  }
}

@media (max-width: 600px) {
  .modal-content {
    max-height: 90vh;
    padding-bottom: 90px;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Loading Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content,
.category-card,
.template-card {
  animation: fadeInUp 0.8s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* --- HERO ANIMATION --- */
.hero-bg-animated {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background: radial-gradient(
      circle at 60% 40%,
      rgba(99, 102, 241, 0.15) 0%,
      transparent 70%
    ),
    radial-gradient(
      circle at 30% 70%,
      rgba(6, 182, 212, 0.12) 0%,
      transparent 80%
    );
  pointer-events: none;
  animation: heroBgMove 8s linear infinite alternate;
}
@keyframes heroBgMove {
  0% {
    background-position: 60% 40%, 30% 70%;
  }
  100% {
    background-position: 65% 45%, 35% 75%;
  }
}

.hero-cta {
  display: inline-block;
  margin-top: 2.5rem;
  padding: 1rem 2.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: var(--border-radius-xl);
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  color: #fff;
  box-shadow: var(--shadow-lg);
  border: none;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.hero-cta:hover {
  background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 32px 0 rgba(99, 102, 241, 0.25);
}

/* --- AIRY SPACING & ACCENT --- */
.section-header h2,
.section-header p {
  margin-bottom: 1.2rem;
}
.templates-grid,
.category-grid {
  gap: 2.5rem 2rem;
}

/* --- GLASSMORPHISM --- */
.template-card,
.modal-content,
.category-card {
  background: rgba(30, 41, 59, 0.85);
  box-shadow: 0 8px 32px 0 rgba(99, 102, 241, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --- BACK TO TOP BUTTON --- */
#backToTop {
  position: fixed;
  bottom: 32px;
  left: 32px;
  z-index: 9999;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  box-shadow: var(--shadow-lg);
  font-size: 1.5rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
#backToTop:hover {
  background: var(--accent-color);
  transform: scale(1.08);
}

/* Modern modal details layout */
.modal-detail-flex {
  display: flex;
  flex-direction: row;
  gap: 2.5rem;
  align-items: flex-start;
  justify-content: center;
}
.modal-detail-image {
  flex: 0 0 340px;
  max-width: 340px;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-detail-info {
  flex: 1 1 0;
  text-align: left;
  min-width: 0;
}
@media (max-width: 900px) {
  .modal-detail-flex {
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
  }
  .modal-detail-image {
    max-width: 100%;
    width: 100%;
    justify-content: center;
  }
  .modal-detail-info {
    text-align: center;
  }
}
.modal-animated-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  border-radius: inherit;
  background: radial-gradient(
      circle at 60% 40%,
      rgba(99, 102, 241, 0.1) 0%,
      transparent 70%
    ),
    radial-gradient(
      circle at 30% 70%,
      rgba(6, 182, 212, 0.1) 0%,
      transparent 80%
    );
  pointer-events: none;
  animation: heroBgMove 8s linear infinite alternate;
}
.modal-fade-in {
  animation: modalFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}
.modal-actions .btn {
  flex: 1 1 0;
  font-size: 1.15rem;
  padding: 1rem 0;
  border-radius: var(--border-radius-xl);
  font-weight: 700;
  box-shadow: var(--shadow-md);
}
@media (max-width: 600px) {
  .modal-actions {
    flex-direction: column;
    gap: 1rem;
  }
  .modal-actions .btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 1.1rem 0;
  }
}

/* Modal header row */
.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  margin-bottom: 1.2rem;
}
.modal-close-btn {
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-muted);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 2rem;
  box-shadow: 0 2px 12px 0 rgba(99, 102, 241, 0.18);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.modal-close-btn:hover {
  background: var(--primary-color);
  color: #fff;
  transform: scale(1.08);
}
.modal-mode-accent {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.mode-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: 50%;
  padding: 0.5em;
  transition: background 0.2s, color 0.2s;
}
.mode-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
}
.accent-picker {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  box-shadow: 0 2px 8px 0 rgba(99, 102, 241, 0.1);
}

/* Modal image and info */
.modal-img-hero {
  width: 100%;
  max-width: 340px;
  max-height: 260px;
  border-radius: 18px;
  box-shadow: 0 4px 24px 0 rgba(99, 102, 241, 0.18);
  border: 3px solid var(--bg-tertiary);
  background: var(--bg-tertiary);
}
.modal-img-placeholder {
  height: 180px;
  width: 100%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 18px;
  font-size: 2.5rem;
}
.modal-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}
.modal-badges {
  margin-bottom: 1rem;
}
.modal-category {
  margin-right: 0.5rem;
}
.tech-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-radius: 999px;
  padding: 0.2rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  margin-right: 0.4rem;
  margin-bottom: 0.2rem;
}
.modal-feature-list {
  margin: 1.2rem 0 0.5rem 0;
  padding-left: 0;
  list-style: none;
}
.modal-feature-list li {
  color: var(--text-primary);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.modal-feature-list i {
  color: var(--success-color);
  font-size: 1.1rem;
}
.modal-meta-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1.2rem;
  font-size: 1rem;
  color: var(--text-muted);
}
.modal-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.modal-price {
  display: inline-block;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}
/* Sticky action bar on mobile */
@media (max-width: 600px) {
  .modal-actions {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.98);
    z-index: 10;
    box-shadow: 0 -2px 16px 0 rgba(99, 102, 241, 0.1);
    padding-bottom: 1.2rem;
    padding-top: 0.5rem;
    flex-direction: column;
    gap: 1rem;
  }
  .modal-actions .btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 1.1rem 0;
  }
}
/* Modal dark/light mode */
.modal-content.modal-dark-mode {
  background: rgba(30, 41, 59, 0.98);
  color: var(--text-primary);
}
.modal-content.modal-dark-mode .modal-detail-info,
.modal-content.modal-dark-mode .modal-feature-list li {
  color: var(--text-primary);
}
.modal-content.modal-dark-mode .modal-close-btn {
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-muted);
}
.modal-content.modal-dark-mode .modal-close-btn:hover {
  background: var(--primary-color);
  color: #fff;
}
.modal-content.modal-dark-mode .modal-img-placeholder {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.modal-content.modal-dark-mode .modal-meta-row {
  color: var(--text-muted);
}
/* Micro-interactions */
.btn,
.modal-close-btn,
.mode-toggle-btn {
  position: relative;
  overflow: hidden;
}
.btn:active::after,
.modal-close-btn:active::after,
.mode-toggle-btn:active::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 120%;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  animation: ripple 0.5s linear;
  pointer-events: none;
}
@keyframes ripple {
  from {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(0.7);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}
/* Animated modal background */
.modal-animated-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  border-radius: inherit;
  background: radial-gradient(
      circle at 60% 40%,
      rgba(99, 102, 241, 0.13) 0%,
      transparent 70%
    ),
    radial-gradient(
      circle at 30% 70%,
      rgba(6, 182, 212, 0.13) 0%,
      transparent 80%
    );
  pointer-events: none;
  animation: heroBgMove 8s linear infinite alternate;
}

.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: 50%;
  padding: 0.5em;
  transition: background 0.2s, color 0.2s;
  margin-right: 0.5rem;
}
.theme-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
}

.modal-desc {
  max-height: 75px; /* Adjust as needed (e.g., 3 lines * 25px line-height) */
  overflow-y: auto; /* Add a scrollbar if it overflows */
  margin-bottom: 1rem;
  padding-right: 1rem; /* Add some space for scrollbar */
}
