:root {
    --primary-color: #007BFF; /* Electric Blue */
    --secondary-color: #0D1117; /* Near Black */
    --text-color: #F0F6FC; /* Light Grey */
    --background-color: #010409; /* Very Dark Blue/Black */
    --card-background: #161B22;
    --border-color: #30363d;
    --highlight-glow: 0 0 15px rgba(0, 123, 255, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.page-header {
    text-align: center;
    padding: 3rem 2rem;
    background-color: var(--secondary-color);
}

/* Responsive Logo Styles */
.page-header .logo img {
    width: 12vw;
    transition: height 0.3s ease;
}

.page-header h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
}

main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

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

.filter-btn {
    background: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

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

.filter-btn.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: var(--highlight-glow);
}

.templates-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.template-card {
    background: var(--card-background);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    flex-basis: calc(33.333% - 2rem); /* Flex basis for 3 columns */
    max-width: calc(33.333% - 2rem);
}

/* ✅ FIXED: Cards now rearrange properly on filter selection */
.template-card.hide {
    display: none;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 123, 255, 0.2);
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-container:hover .video-controls {
    opacity: 1;
}

.fullscreen-btn {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fullscreen-btn svg {
    width: 18px;
    height: 18px;
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-header h3 {
    font-size: 1.4rem;
    color: #fff;
}

.disclaimer-icon {
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.disclaimer-icon:hover {
    opacity: 1;
    color: var(--primary-color);
}

.category-tag {
    font-size: 0.8rem;
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    align-self: flex-start;
    margin-bottom: 1rem;
}

.description-toggle {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}
.description-toggle p {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.description-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}
.description-toggle.active svg {
    transform: rotate(180deg);
}

.description-content {
    max-height: 0;
    overflow: hidden; /* Ensures content is hidden when max-height is 0 */
    transition: max-height 0.5s ease-out, padding-bottom 0.5s ease-out;
    font-size: 0.9rem;
    color: rgba(240, 246, 252, 0.8);
    /* NEW: Add scroll properties for when it expands */
    overflow-y: hidden; /* Start hidden, will change to scroll or auto when shown */
    -webkit-overflow-scrolling: touch; /* Improves scrolling on iOS devices */
}

.description-content.show {
    max-height: 150px; /* Adjusted to desired initial expanded height. Adjust as needed! */
    padding-bottom: 1rem;
    overflow-y: auto; /* Adds a scrollbar only when content overflows the max-height */
}

/* Optional: Style the scrollbar for WebKit browsers (Chrome, Safari, new Edge) */
.description-content.show::-webkit-scrollbar {
    width: 8px; /* Width of the vertical scrollbar */
}

.description-content.show::-webkit-scrollbar-track {
    background: var(--card-background); /* Background of the scrollbar track */
    border-radius: 10px;
}

.description-content.show::-webkit-scrollbar-thumb {
    background-color: var(--primary-color); /* Color of the scrollbar thumb */
    border-radius: 10px;
    border: 2px solid var(--card-background); /* Padding around the thumb */
}

.price-info {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.price {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}

.price-note {
    font-size: 0.8rem;
    color: rgba(240, 246, 252, 0.7);
}

.cta-card-button {
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.cta-card-button:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--card-background);
    margin: 15% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
    animation: slideIn 0.3s;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

@keyframes fadeIn {
    from {opacity: 0}
    to {opacity: 1}
}

@keyframes slideIn {
    from {transform: translateY(-50px)}
    to {transform: translateY(0)}
}

/* Footer Styles Added */
footer {
    background-color: var(--secondary-color);
    padding: 4rem 2rem 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    max-width: 1200px;
    margin: 0 auto;
}

.footer-main {
    flex-basis: 40%;
}

.footer-main h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.cta-button-footer {
    background: var(--primary-color);
    color: #fff;
    padding: 12px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
}

.cta-button-footer:hover {
    background-color: #0056b3;
}

.footer-links {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #fff;
}

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

.footer-col ul li a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

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

.footer-bottom {
    padding-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(240, 246, 252, 0.7);
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 900px) {
    .template-card {
        flex-basis: calc(50% - 2rem); /* 2 columns on tablet */
        max-width: calc(50% - 2rem);
    }
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-main {
        margin-bottom: 2rem;
    }
    .page-header .logo img{
        width: 19vw;
    }
}

@media (max-width: 600px) {
    .template-card {
        flex-basis: 100%; /* 1 column on mobile */
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .page-header .logo img{
        width: 23vw;
    }
}

@media (max-width: 480px) {
    .footer-links {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .page-header .logo img{
        width: 30vw;
    }
}