/* ==========================================================
   WISAXIS — CARD & BENTO COMPONENTS (2026 SaaS Design System)
   Bento grids, elevated glass cards, template showcase tiles,
   and interactive hover transitions.
   ========================================================== */

/* ===== ADAPTIVE GLASS CARD ===== */
.adaptive-card,
.glass-card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.3s var(--ease-spring),
    box-shadow 0.3s var(--ease-out-smooth),
    border-color 0.3s ease;
  position: relative;
}

.adaptive-card:hover,
.glass-card:hover {
  transform: translateY(-4px) scale(1.008);
  border-color: var(--surface-border-hover);
  box-shadow: var(--shadow-hover);
}

html[data-theme="light"] .adaptive-card,
html[data-theme="light"] .glass-card {
  background: #ffffff;
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

html[data-theme="light"] .adaptive-card:hover,
html[data-theme="light"] .glass-card:hover {
  border-color: var(--surface-border-hover);
  box-shadow: var(--shadow-md);
}

/* ===== 2026 BENTO GRID SYSTEM ===== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  max-width: 1240px;
  margin: 0 auto;
}

.bento-card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.35s var(--ease-spring),
    box-shadow 0.35s var(--ease-out-smooth),
    border-color 0.35s ease;
  position: relative;
  overflow: hidden;
}

.bento-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bento-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: var(--surface-border-hover);
  box-shadow: var(--shadow-hover);
}

.bento-card:hover::before {
  opacity: 1;
}

html[data-theme="light"] .bento-card {
  background: #ffffff;
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

html[data-theme="light"] .bento-card:hover {
  box-shadow: var(--shadow-lg);
}

.bento-col-8 {
  grid-column: span 8;
}

.bento-col-4 {
  grid-column: span 4;
}

.bento-col-6 {
  grid-column: span 6;
}

.bento-col-12 {
  grid-column: span 12;
}

.bento-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
  border: 1px solid rgba(14, 165, 233, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.bento-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  color: var(--text-main);
  margin: 0 0 0.75rem;
}

.bento-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
}

@media (max-width: 900px) {
  .bento-col-8,
  .bento-col-4,
  .bento-col-6 {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .adaptive-card,
  .glass-card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .bento-grid {
    gap: 1rem;
  }

  .bento-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .bento-icon {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
  }

  .bento-title {
    font-size: var(--text-lg);
  }
}

@media (max-width: 480px) {
  .bento-card {
    padding: 1.25rem;
  }
}

/* ===== HOME PAGE CAROUSEL CARD ===== */
.template-card {
  width: 250px;
  height: 340px;
  flex-shrink: 0;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  overflow: hidden;
  position: relative;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 22px;

  /* Template preview image */
  background-image: var(--template-img);
  background-size: cover;
  background-position: top center;
  background-color: var(--surface-2);
  cursor: pointer;

  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

/* Dark gradient scrim overlay */
.template-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.45) 50%,
    rgba(0, 0, 0, 0.05) 100%
  );
  z-index: 1;
  transition: opacity 0.3s ease;
}

.template-card:hover::before {
  opacity: 0.85;
}

/* Top shine sweep */
.template-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.15) 30%,
    rgba(255, 255, 255, 0.30) 50%,
    rgba(255, 255, 255, 0.15) 70%,
    transparent
  );
  transform: skewX(-25deg);
  transition: none;
  z-index: 3;
  pointer-events: none;
}

.template-card:hover::after {
  left: 150%;
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.template-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.65), 0 0 24px var(--primary-glow);
  border-color: var(--primary);
}

/* Card content */
.template-name {
  position: relative;
  z-index: 2;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: var(--tracking-tight);
  color: #ffffff;
  display: block;
  margin-bottom: 6px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.template-tag {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}

/* ===== TEMPLATE SIDEBAR THUMBNAIL (Template Editor) ===== */
.template-thumb {
  width: 100%;
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
  transition: transform var(--shell-transition),
              box-shadow var(--shell-transition),
              border-color var(--shell-transition);
}

.template-thumb:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 12px 28px var(--primary-glow);
}

@media (min-width: 501px) {
  .template-thumb {
    height: 190px;
  }
}

@media screen and (max-width: 500px) {
  .template-thumb {
    width: 72px;
    height: 102px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }

  .template-link:active .template-thumb {
    transform: scale(0.96);
  }

  .template-link {
    width: auto !important;
  }
}

.template-link {
  text-decoration: none;
  flex: none;
  display: block;
  width: 100%;
}

/* ===== MOBILE SIZES ===== */
@media (max-width: 768px) {
  .template-card {
    width: 210px;
    height: 290px;
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .template-card {
    width: 180px;
    height: 250px;
    padding: 14px;
  }

  .template-name {
    font-size: 0.95rem;
  }
}
