/* Template Generator Page Styles */

.templates-hero {
    padding: 10rem 2rem 4rem;
    text-align: center;
    background: var(--black);
    position: relative;
    overflow: hidden;
}

.templates-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 50%, rgba(255, 0, 153, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(0, 255, 136, 0.2) 0%, transparent 50%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.templates-title {
    position: relative;
    font-family: 'Orbitron', monospace;
    font-size: clamp(3rem, 12vw, 10rem);
    font-weight: 900;
    line-height: 0.9;
    margin-bottom: 2rem;
    background: linear-gradient(90deg, var(--accent), var(--glow), var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: skewX(-12deg);
    animation: gradient-shift 3s ease infinite;
    z-index: 1;
}

.templates-subtitle {
    position: relative;
    font-size: 1.5rem;
    color: var(--white);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0.8;
    z-index: 1;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--white);
    padding: 1rem 2rem;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--glow));
    transition: left 0.3s ease;
    z-index: -1;
}

.tab-btn:hover::before,
.tab-btn.active::before {
    left: 0;
}

.tab-btn.active {
    color: var(--black);
    border-color: var(--glow);
}

/* Tab Content */
.tab-content {
    min-height: 60vh;
    padding: 4rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.tiktok-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.template-item {
    position: relative;
}

.template-item.square .template-preview {
    aspect-ratio: 1;
}

.template-item.tall .template-preview {
    height: 500px;
}

.template-item.wide {
    grid-column: span 2;
}

.template-item.wide .template-preview {
    height: 250px;
}

/* Template Previews */
.template-preview {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.template-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
    z-index: 0;
}

/* Twitter Templates */
.twitter-1::before { background: url('images/gallery-7.png') center/cover; }
.twitter-2::before { background: url('images/gallery-12.png') center/cover; }
.twitter-3::before { background: url('images/gallery-3.png') center/cover; }
.twitter-4::before { background: url('images/gallery-15.png') center/cover; }

/* TikTok Templates */
.tiktok-1::before { background: url('images/gallery-18.png') center/cover; }
.tiktok-2::before { background: url('images/gallery-20.png') center/cover; }
.tiktok-3::before { background: url('images/gallery-22.png') center/cover; }

/* Discord Templates */
.discord-1::before { background: url('images/gallery-9.png') center/cover; }
.discord-2::before { background: url('images/gallery-14.png') center/cover; }
.discord-3::before { background: url('images/gallery-16.png') center/cover; }

/* Instagram Templates */
.insta-1::before { background: url('images/gallery-5.png') center/cover; }
.insta-2::before { background: url('images/gallery-10.png') center/cover; }
.insta-3::before { background: url('images/gallery-21.png') center/cover; }

/* Meme Templates */
.meme-1::before { background: url('images/gallery-11.png') center/cover; }
.meme-2::before { background: url('images/gallery-13.png') center/cover; }
.meme-3::before { background: url('images/gallery-17.png') center/cover; }
.meme-4::before { background: url('images/gallery-19.png') center/cover; }

/* New Meme Styles */
.meme-5 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.meme-6 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.meme-7 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.meme-8 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.meme-9 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.meme-10 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.meme-11 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.meme-12 { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }

/* Drake Meme Layout */
.drake-meme {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.drake-no, .drake-yes {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    padding: 1rem;
    border-radius: 10px;
    margin: 0.5rem 0;
}

.drake-no {
    background: rgba(255, 0, 0, 0.2);
    color: white;
    border: 2px solid #ff4444;
}

.drake-yes {
    background: rgba(0, 255, 0, 0.2);
    color: white;
    border: 2px solid #44ff44;
}

/* This is Fine Meme */
.meme-single {
    font-family: Impact, sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 1rem;
}

.meme-caption {
    font-size: 1rem;
    color: white;
    text-align: center;
    font-style: italic;
    opacity: 0.9;
}

/* Distracted Boyfriend Layout */
.boyfriend-meme {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    height: 100%;
    gap: 0.5rem;
    align-items: center;
}

.boyfriend-left, .boyfriend-center, .boyfriend-right {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
}

.boyfriend-left { background: rgba(255, 255, 255, 0.1); }
.boyfriend-center { background: rgba(255, 100, 100, 0.3); transform: scale(1.1); }
.boyfriend-right { background: rgba(0, 255, 136, 0.3); }

/* Two Buttons Layout */
.meme-question, .meme-answer {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-align: center;
}

.buttons-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.button-option {
    background: linear-gradient(45deg, var(--accent), var(--glow));
    color: var(--black);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 900;
    font-family: 'Orbitron', monospace;
}

/* Brain Levels Layout */
.brain-levels {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.brain-level, .brain-level-final {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    margin: 0.2rem 0;
}

.brain-level { 
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.7;
}

.brain-level-final { 
    background: linear-gradient(45deg, var(--accent), var(--glow));
    color: var(--black);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

/* Change My Mind Layout */
.change-mind-text {
    font-family: Impact, sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 1rem;
    text-align: center;
}

.change-mind-caption {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--glow);
    text-align: center;
    margin-bottom: 0.5rem;
}

.change-mind-footer {
    font-size: 0.8rem;
    color: white;
    opacity: 0.8;
    text-align: center;
}

/* Wojak Chad Layout */
.wojak-chad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    gap: 0.5rem;
}

.wojak-side, .chad-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    border-radius: 10px;
}

.wojak-side {
    background: rgba(255, 100, 100, 0.2);
    border: 2px solid #ff6666;
}

.chad-side {
    background: rgba(0, 255, 136, 0.2);
    border: 2px solid var(--glow);
}

.wojak-text, .chad-text {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: white;
    text-align: center;
    font-size: 0.9rem;
}

.chad-text {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.chad-subtext {
    font-size: 0.8rem;
    color: var(--glow);
    font-weight: 400;
}

/* Three-line meme layout */
.meme-middle {
    font-family: Impact, sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    text-align: center;
    margin: 0.5rem 0;
}

/* Banner Templates */
.banner-1::before { background: url('images/gallery-4.png') center/cover; }
.banner-2::before { background: url('images/gallery-6.png') center/cover; }
.banner-3::before { background: url('images/gallery-8.png') center/cover; }

/* Dark overlay for template backgrounds */
.template-preview .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
    pointer-events: none;
}

/* F• Logo in top center for all templates */
.template-preview .fartist-logo {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--glow);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    z-index: 3;
    opacity: 0.8;
    pointer-events: none;
}

/* $FARTIST watermark in bottom right corner */
.template-preview .fartist-watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--glow);
    opacity: 0.6;
    z-index: 3;
    letter-spacing: 0.1em;
    pointer-events: none;
}

.template-preview:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--glow);
    box-shadow: 0 20px 40px rgba(0, 255, 136, 0.3);
}

.template-preview h3,
.template-preview p,
.template-preview span {
    position: relative;
    z-index: 2;
}

.template-preview h3 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    transform: skewX(-12deg);
}

.template-preview h3.huge {
    font-size: 3rem;
}

.template-preview h3.big-f {
    font-size: 6rem;
}

.template-preview p {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.template-preview span {
    font-size: 1rem;
    color: var(--glow);
    opacity: 0.8;
}

/* TikTok Content */
.tiktok-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 2rem;
}

.tiktok-quote {
    font-style: italic;
    font-size: 1.1rem !important;
    margin-bottom: 2rem !important;
}

.viral-ref {
    font-size: 1rem !important;
    opacity: 0.7 !important;
    font-style: italic;
}

/* Meme Styles */
.meme-top, .meme-bottom {
    font-family: Impact, sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    color: white;
    text-shadow: 
        2px 2px 0 black,
        -2px -2px 0 black,
        2px -2px 0 black,
        -2px 2px 0 black;
}

.meme-space {
    height: 80px;
}

/* Generate Button */
.gen-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(90deg, var(--accent), var(--glow));
    border: none;
    border-radius: 10px;
    color: var(--black);
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.gen-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: width 0.6s, height 0.6s;
}

.gen-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.4);
}

.gen-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Output Modal */
.output-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: var(--black);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    width: auto;
    max-width: min(90vw, 800px);
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: 2px solid var(--glow);
    color: var(--glow);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--glow);
    color: var(--black);
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--white);
    text-align: center;
    transform: skewX(-12deg);
}

#outputCanvas {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(85vh - 200px);
    object-fit: contain;
    border: 2px solid var(--glow);
    border-radius: 20px;
    margin: 0 auto 2rem;
    display: block;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.3);
}

.output-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.download-final,
.copy-link,
.new-template {
    padding: 1rem 2rem;
    background: transparent;
    border: 2px solid var(--glow);
    color: var(--glow);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-final:hover,
.copy-link:hover,
.new-template:hover {
    background: var(--glow);
    color: var(--black);
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .tab-navigation {
        gap: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .template-item.wide {
        grid-column: span 1;
    }
    
    .output-actions {
        flex-direction: column;
    }
}