/* ===== Template Gallery ===== */
.tg-hero {
  padding: 120px 0 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  text-align: center;
}
.tg-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.tg-hero-sub {
  font-size: 1.15rem;
  opacity: 0.9;
}

.tg-gallery {
  padding: 50px 0 80px;
  background: #f8f9fa;
}
.tg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.tg-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.tg-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.tg-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.tg-card-preview {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #e9ecef;
  position: relative;
}
.tg-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.3s;
}
.tg-card:hover .tg-card-preview img {
  transform: scale(1.03);
}
.tg-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #ccc;
}

.tg-card-info {
  padding: 16px 20px 8px;
}
.tg-card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #667eea;
  background: rgba(102,126,234,0.1);
  padding: 3px 10px;
  border-radius: 20px;
}
.tg-card-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 8px 0 4px;
  color: #222;
}
.tg-card-desc {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

.tg-card-actions {
  position: absolute;
  inset: 0;
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
}
.tg-card:hover .tg-card-actions {
  opacity: 1;
}
.tg-card-actions .tg-btn {
  width: 70%;
  text-align: center;
  flex: none;
}

.tg-btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.tg-btn-preview {
  background: #f0f0f0;
  color: #333;
  flex: 1;
}
.tg-btn-preview:hover {
  background: #e0e0e0;
  color: #333;
  text-decoration: none;
}
.tg-btn-use {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  flex: 1;
}
.tg-btn-use:hover {
  opacity: 0.9;
  color: #fff;
  text-decoration: none;
}
.tg-btn-lg {
  padding: 12px 32px;
  font-size: 1.05rem;
}

/* ===== Template Preview Page ===== */
.tp-header {
  padding: 100px 0 20px;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.tp-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.tp-back {
  font-size: 0.9rem;
  color: #667eea;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 8px;
}
.tp-back:hover {
  text-decoration: underline;
  color: #764ba2;
}
.tp-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #222;
}
.tp-desc {
  color: #666;
  margin: 8px 0 0;
  max-width: 500px;
}
.tp-actions {
  padding-top: 10px;
}

.tp-page-tabs {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  padding-bottom: 0;
}
.tp-page-tab {
  background: #f0f0f0;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: #555;
  transition: all 0.2s;
}
.tp-page-tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}
.tp-page-tab:hover:not(.active) {
  background: #e0e0e0;
}

.tp-preview-section {
  padding: 30px 0;
  background: #f0f2f5;
}
.tp-preview-frame {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border: 1px solid #ddd;
}
.tp-preview-frame iframe {
  width: 100%;
  min-height: 700px;
  border: none;
  display: block;
}

.tp-cta {
  padding: 60px 0;
  background: #fff;
}
.tp-cta h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.tp-cta p {
  color: #666;
  margin-bottom: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .tg-hero { padding: 100px 0 30px; }
  .tg-hero h1 { font-size: 1.8rem; }
  .tg-grid { grid-template-columns: 1fr; }
  .tp-header-top { flex-direction: column; }
  .tp-title { font-size: 1.5rem; }
  .tp-preview-frame iframe { min-height: 400px; }
}
