:root {
    /* Krea-inspired Palette (from previous response, adjust if needed) */
    --krea-bg-darkest: #101114;
    --krea-bg-darkest-rgb: 16, 17, 20; /* For RGBA overlays */
    --krea-bg-dark: #181A1E;
    --krea-bg-medium: #24262B;
    --krea-bg-light: #FFFFFF;

    --krea-text-primary: #EAEAEB;
    --krea-text-secondary: #86888C;
    --krea-text-dark: #101114;

    --krea-accent-green: #0FA882;
    --krea-accent-blue: #2E72D2;
    --krea-accent-purple: #7442D8;
    --krea-accent-active-border: #4A4D54;

    --krea-border-subtle: #2D2F34;
    --krea-border-strong: #4A4D54;
    --krea-shadow-soft: 0 4px 12px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--krea-bg-darkest); /* Fallback */
    color: var(--krea-text-primary);
    position: relative; /* For video background */
}

/* Video Background */
.body-video-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden; z-index: -2; /* Behind everything, even body's direct content if any */
}
.body-video-background video { width: 100%; height: 100%; object-fit: cover; }
.body-video-background::before { /* Stronger gradient overlay */
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(var(--krea-bg-darkest-rgb), 0.85) 0%, /* More opaque at top */
        rgba(var(--krea-bg-darkest-rgb), 0.95) 70%,
        rgba(var(--krea-bg-darkest-rgb), 1) 100%
    );
    z-index: 1; /* On top of video, under page content */
}


/* Header Styles */
.member-header { background-color: var(--krea-bg-dark);display:flex;justify-content:space-between;flex-wrap:wrap;align-items: center; border-bottom: 1px solid var(--krea-border-subtle); position: sticky; top: 0; z-index: 1000; box-shadow: var(--krea-shadow-soft); }
.main-nav .nav-link { color: var(--krea-text-secondary); text-decoration: none; margin-right: 25px; font-size: 0.95em; font-weight: 500; padding: 10px 5px; position: relative; transition: color 0.3s ease; }
.main-nav .nav-link:hover { color: var(--krea-text-primary); }
.main-nav .nav-link.active { color: var(--krea-accent-green); font-weight: 600; }
.main-nav .nav-link.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 3px; background: var(--krea-accent-green); border-radius: 2px; }
.user-info{display:flex;align-items:center;gap:10px;margin-left:auto;}
.user-info > * { font-size: 0.9em; }
.user-info>.buttons{display:flex;gap:10px;align-items:center;}
.user-info a {text-decoration: none; color: var(--krea-text-secondary);}
.user-info a.upgrade-button {color: var(--krea-text-primary);}
.credits-display, .current-plan { color: var(--krea-text-secondary); }
.credits-display #creditsAmountValue { color: var(--krea-accent-blue); font-weight: 600; }
.current-plan-value { color: var(--krea-text-primary); font-weight: 600; }
.upgrade-button { background: var(--krea-accent-blue); color: var(--krea-bg-light); border: none; padding: 8px 18px; border-radius: 20px; font-weight: 600; cursor: pointer; transition: background-color 0.3s ease; font-size: 0.85em; }
.upgrade-button:hover { background-color: color-mix(in srgb, var(--krea-accent-blue) 85%, black); }
.profile-icon { font-size: 1.8em; color: var(--krea-text-secondary); cursor: pointer; transition: color 0.3s ease; }
.profile-icon:hover { color: var(--krea-accent-blue); }

/* --- Viral Templates Page Styles --- */
.page-content-templates {
    padding: 30px 40px;
    max-width: 1200px; 
    margin: 0 auto;
    position: relative; /* For z-index stacking context */
    z-index: 1; /* Above video background's overlay */
}

.templates-page-header { text-align: center; margin-bottom: 30px; }
.templates-page-title { font-size: 2em; font-weight: 700; color: var(--krea-text-primary); margin-bottom: 8px; }
.templates-page-subtitle { font-size: 1em; color: var(--krea-text-secondary); }

.template-categories-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 1px solid var(--krea-border-subtle); overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
.template-categories-nav::-webkit-scrollbar { display: none; }
.template-category-btn { background-color: var(--krea-bg-dark); color: var(--krea-text-secondary); border: 1px solid var(--krea-border-subtle); padding: 8px 18px; border-radius: 20px; font-size: 0.9em; font-weight: 500; cursor: pointer; transition: all 0.2s ease; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.template-category-btn:hover { color: var(--krea-text-primary); background-color: var(--krea-bg-medium); border-color: var(--krea-border-strong); }
.template-category-btn.active { color: var(--krea-text-dark); background-color: var(--krea-bg-light); border-color: var(--krea-bg-light); font-weight: 600; }
.template-category-btn img.category-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.template-category-scroll-arrow { background-color: var(--krea-bg-dark); color: var(--krea-text-secondary); border: 1px solid var(--krea-border-subtle); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; }
.template-category-scroll-arrow:hover { color: var(--krea-text-primary); background-color: var(--krea-bg-medium); }

.template-section { margin-bottom: 40px;}
.template-section-title { font-size: 1.6em; font-weight: 600; color: var(--krea-text-primary); margin-bottom: 20px; }
a.section-anchor{scroll-margin-top: 80px;}

.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.template-card { background-color: var(--krea-bg-dark); border-radius: 12px; border: 1px solid var(--krea-border-subtle); overflow: hidden; position: relative; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.template-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.2); border-color: var(--krea-border-strong); }
.template-card-image-wrapper { width: 100%; aspect-ratio: 16 / 9; background-color: var(--krea-bg-medium); position: relative; }
.template-card-image-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; }
.template-card-image-wrapper video { width: 100%; height: 100%; object-fit: cover; display: block; }
.template-card-info { padding: 15px; }
.template-card-title { font-size: 1.05em; font-weight: 600; color: var(--krea-text-primary); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-card-description { font-size: 0.8em; color: var(--krea-text-secondary); line-height: 1.4; height: 3.92em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

.template-card-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(16, 17, 20, 0.7); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
.template-card:hover .template-card-overlay { opacity: 1; visibility: visible; transition-delay: 0s; }
.create-template-btn { background-color: var(--krea-accent-blue); color: var(--krea-bg-light); padding: 10px 25px; border-radius: 20px; font-size: 0.95em; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background-color 0.2s ease; }
.create-template-btn:hover { background-color: color-mix(in srgb, var(--krea-accent-blue) 85%, black); }
.create-template-btn i { font-size: 1.1em; }

@media (max-width: 1100px) { .templates-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
@media (max-width: 768px) { .page-content-templates { padding: 20px; } .templates-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; } .template-section-title { font-size: 1.4em; } .templates-page-title { font-size: 1.8em; } }
@media (max-width: 520px) { .template-categories-nav { padding-bottom: 10px; margin-bottom: 20px; } .template-category-btn { padding: 7px 15px; font-size: 0.85em; } .templates-grid { grid-template-columns: 1fr; } .templates-page-title { font-size: 1.6em; } }

.Hidden {display: none;}

.upgrade-overlay {position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(100,100,100,0.8);
  border-radius: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;  
}

.upgrade-overlay .upgrade-template-btn { background-color: var(--krea-accent-blue); color: var(--krea-bg-light); padding: 10px 25px; border-radius: 20px; font-size: 0.95em; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background-color 0.2s ease; }
.upgrade-overlay .upgrade-template-btn:hover { background-color: color-mix(in srgb, var(--krea-accent-blue) 85%, black); }
.upgrade-overlay .upgrade-template-btn i { font-size: 1.1em; }

.upgrade-overlay .upgrade-template-btn a {display: block;
  color: #fff;
  text-decoration: none;
    height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;  
}

