/* ===================================================================
   Templates Page Stylesheet
   Author: Mujtaba Alam
   Version: 1.0.0
   Description: A unique, premium style for the template selection page.
   =================================================================== */

/* --- 1. ROOT & VARIABLES --- */
:root {
    /* Base variables for consistency */
    --primary-color: #007BFF;
    --text-color-light: #d1d9e6;
    --heading-color-light: #ffffff;
    --white-color: #ffffff;
    --font-primary: 'Poppins', sans-serif;
    --transition-speed: 0.3s;
    --border-radius: 16px; /* Slightly sharper radius for a modern feel */

    /* Custom dark theme for this page */
    --templates-bg-dark: #2c3e50;
    --templates-bg-card: #34495e;
    
    /* Dark theme neumorphic shadows */
    --dark-shadow-light: rgba(46, 62, 78, 0.25);
    --dark-shadow-dark: rgba(0, 0, 0, 0.25);
}

/* --- 2. GLOBAL & PAGE SETUP --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body.templates-page {
    font-family: var(--font-primary);
    background-color: var(--templates-bg-dark); /* Dark background */
    color: var(--text-color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 60px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container { width: 90%; max-width: 1200px; margin: 0 auto; text-align: center; }
h2 {
    font-size: clamp(2.2rem, 5vw, 2.8rem);
    color: var(--heading-color-light);
    margin-bottom: 15px;
}
p.section-subtitle {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 50px auto;
    color: var(--text-color-light);
    opacity: 0.8;
}

/* --- 3. TEMPLATE GRID & CARDS --- */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 35px;
}

.template-card {
    background: var(--templates-bg-card);
    border-radius: var(--border-radius);
    text-align: left;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 10px 20px var(--dark-shadow-dark), -10px -10px 20px var(--dark-shadow-light);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.template-card:hover {
    transform: translateY(-10px);
    box-shadow: 15px 15px 30px var(--dark-shadow-dark), -15px -15px 30px var(--dark-shadow-light);
}

.template-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    border-bottom: 2px solid var(--primary-color);
}

.template-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Ensures footer of card aligns */
}

.template-info h3 {
    font-size: 1.4rem;
    color: var(--heading-color-light);
    margin-bottom: 15px;
}

.template-details-list {
    list-style: none;
    margin-bottom: 20px;
    flex-grow: 1;
}

.template-details-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--text-color-light);
}

.template-details-list li i {
    color: var(--primary-color);
    font-size: 1.1rem;
    width: 20px;
}

/* --- 4. BUTTONS & ACTIONS --- */
.template-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: auto; /* Pushes to the bottom */
}

.neumorphic-btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-align: center;
}

/* Secondary Button (Preview) */
.neumorphic-btn.secondary {
    background-color: transparent;
    color: var(--white-color);
    box-shadow: inset 0 0 0 2px var(--text-color-light);
}

.neumorphic-btn.secondary:hover {
    background-color: var(--text-color-light);
    color: var(--templates-bg-dark);
}

/* Primary Button (Customize) */
.neumorphic-btn.primary {
    background: var(--primary-color);
    color: var(--white-color);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.2);
}

.neumorphic-btn.primary:hover {
    background: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}

.back-to-home-container {
    margin-top: 50px;
}

a.back-to-home {
    color: var(--text-color-light);
    font-weight: 600;
    opacity: 0.8;
    transition: opacity var(--transition-speed) ease;
}

a.back-to-home:hover {
    opacity: 1;
    color: var(--white-color);
}

/* --- 5. PREVIEW MODAL --- */
/* (This section is copied and adapted for the dark theme) */
.preview-modal-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 3000; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
    padding: 20px;
}
.preview-modal-content {
    width: 100%; max-width: 1200px; height: 90vh; display: flex; flex-direction: column;
    background-color: var(--templates-bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 1px solid var(--dark-shadow-light);
}
.browser-header {
    display: flex; align-items: center; padding: 12px 15px;
    border-bottom: 1px solid var(--dark-shadow-light);
    flex-shrink: 0;
}
.browser-dots { display: flex; gap: 8px; }
.browser-dots .dot { width: 12px; height: 12px; border-radius: 50%; }
.browser-dots .red { background-color: #ff5f57; }
.browser-dots .yellow { background-color: #ffbd2e; }
.browser-dots .green { background-color: #28ca41; }
.browser-bar {
    flex-grow: 1; margin: 0 20px; padding: 8px 15px;
    border-radius: 8px; font-size: 0.9rem;
    display: flex; align-items: center; gap: 8px;
    background-color: var(--templates-bg-dark);
    color: var(--text-color-light);
    overflow: hidden;
    overflow-x: auto;
    font-size: 10px;
}
.close-icon-preview {
    font-size: 2.2rem; font-weight: bold; cursor: pointer; line-height: 1;
    color: var(--text-color-light); transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
}
.close-icon-preview:hover {
    color: var(--white-color);
    transform: rotate(90deg);
}
.browser-body {
    flex-grow: 1; padding: 10px; overflow: hidden;
}
.browser-body iframe {
    width: 100%; height: 100%; border-radius: 8px;
    background-color: var(--white-color);
}

/* --- 6. ANIMATIONS --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}