/*
Theme Name: ComfyArts GenZ
Author: Your Name
Description: Dark cosmic theme with masonry layout inspired by the Gemini canvas design.
Version: 1.0
*/

/* --- RESET & VARIABLES --- */
:root {
    --bg-dark: #000000; /* Deep Black */
    --card-bg: #0a0a0a;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-green: #4ade80; /* Neon Green */
    --accent-gold: #ffd700;
    --border-default: rgba(74, 222, 128, 0.1); 
    --border-glow: rgba(74, 222, 128, 0.4);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- 3D COSMIC DUST BACKGROUND --- */
/* Layer 1: Tiny distant stars (Static/Very Slow) */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(white 1px, transparent 1.5px),
        radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1.5px);
    background-size: 550px 550px, 350px 350px;
    background-position: 0 0, 150px 80px;
    opacity: 0.3;
    pointer-events: none;
    z-index: -3;
}

/* Layer 2: Cosmic Dust / Nebula (Flowing) */
body::after {
    content: "";
    position: fixed;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background-image: 
        radial-gradient(circle at center, rgba(74, 222, 128, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(255, 215, 0, 0.02) 0%, transparent 30%);
    background-size: 100% 100%;
    opacity: 0.6;
    pointer-events: none;
    z-index: -2;
    animation: cosmic-drift 120s linear infinite;
}

/* Layer 3: Sparkling Particles (Running) */
.cosmic-particles {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.8) 1px, transparent 1px),
        radial-gradient(rgba(74, 222, 128, 0.6) 1px, transparent 1px);
    background-size: 400px 400px, 300px 300px;
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
    animation: particle-run 60s linear infinite;
}

@keyframes cosmic-drift {
    0% { transform: rotate(0deg) translate(0, 0); }
    100% { transform: rotate(5deg) translate(-20px, -20px); }
}

@keyframes particle-run {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 400px 400px, -300px 300px; }
}

/* --- DYNAMIC ISLAND HEADER --- */
.site-header {
    position: fixed;
    /* Move the floating navigation slightly down from the very top to give
       the header breathing room.  Increasing this value will push the
       navigation further down the page. */
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    z-index: 1000;
    display: flex;
    justify-content: center;
}

.nav-pill {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9999px;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.nav-pill:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.15);
}

.site-branding {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-branding span { color: var(--accent-green); }

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.main-nav a:hover, .main-nav a.active {
    color: white;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-green);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px var(--accent-green);
}

.main-nav a:hover::after { width: 100%; }

.pro-badge {
    display: none; /* Hidden by default */
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: black;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 10px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

body.is-pro .pro-badge { display: inline-block; }
body.is-pro .login-link { display: none; }

/* --- MOBILE NAVIGATION --- */
@media (max-width: 768px) {
    .nav-pill {
        padding: 0.75rem 1rem;
    }
    .main-nav ul {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    .main-nav a {
        font-size: 1.1rem;
        color: var(--accent-green);
        text-shadow: 0 0 6px var(--accent-green);
    }
    .main-nav a:hover::after {
        width: 0; /* Disable underline effect on mobile */
    }
    .main-nav a:hover {
        color: var(--accent-gold);
        text-shadow: 0 0 8px var(--accent-gold);
    }
}

/* --- LAYOUT --- */
.site-main {
    padding-top: 120px;
    padding-bottom: 60px;
    max-width: 1800px;
    margin: 0 auto;
    width: 95%;
}

/* --- HERO SECTION --- */
.hero-section {
    text-align: center;
    margin-bottom: 60px;
    padding: 40px 20px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 20%, var(--accent-green) 50%, var(--accent-gold) 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 4px 0px rgba(74, 222, 128, 0.2));
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.4), 0 0 60px rgba(255, 215, 0, 0.2);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn {
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-block;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: rgba(74, 222, 128, 0.1);
    color: var(--accent-green);
    border-color: var(--accent-green);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.2);
}

.btn-primary:hover {
    background: var(--accent-green);
    color: #000;
    box-shadow: 0 0 25px rgba(74, 222, 128, 0.6);
}

/* --- MASONRY GALLERY --- */
.gallery-grid {
    column-count: 1;
    column-gap: 10px; /* Minimal gap */
}

@media (min-width: 600px) { .gallery-grid { column-count: 2; } }
@media (min-width: 900px) { .gallery-grid { column-count: 3; } }
@media (min-width: 1200px) { .gallery-grid { column-count: 4; } }
@media (min-width: 1600px) { .gallery-grid { column-count: 5; } }

.art-card {
    background: var(--card-bg);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    margin-bottom: 10px; /* Minimal gap */
    overflow: hidden;
    break-inside: avoid;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
}

.art-card:hover {
    transform: scale(1.01);
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.1);
}

.art-card__image-wrapper {
    position: relative;
    width: 100%;
    display: block;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.art-card__image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- ACTION BUTTONS (Fav & Download) --- */
.icon-btn-style {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(11, 17, 33, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn-style:hover {
    border-color: var(--accent-green);
    color: white;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.3);
    background: rgba(74, 222, 128, 0.1);
}

.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.fav-btn.active {
    background: var(--accent-green);
    color: #000;
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
}

/* Small Download Button (Styled like Fav) */
.download-btn-small {
    margin-bottom: 8px; /* Space above prompt */
    display: inline-flex;
    /* width: auto; Allow slightly wider if needed, but keeping it circle/icon style looks best */
}

.download-btn-small svg {
    pointer-events: none;
}

.art-card__content {
    padding: 12px;
}

.art-card__title {
    font-size: 0.95rem;
    color: white;
    margin-bottom: 4px;
    font-weight: 600;
}

.art-card__meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- PROMPT CONSOLE --- */
.prompt-console {
    background: #000;
    border: 1px solid #222;
    border-radius: 6px;
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-green);
    position: relative;
    min-height: 50px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s;
}

.prompt-console:hover { border-color: #333; }

.prompt-console-header {
    display: flex;
    justify-content: flex-end; /* Just copy button now */
    margin-bottom: 0px;
    height: 0; /* floating copy button */
}

.copy-btn {
    position: relative;
    top: -2px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    cursor: pointer;
    font-family: var(--font-main);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 5;
}

.prompt-console:not(.is-locked):hover .copy-btn {
    opacity: 1;
    pointer-events: auto;
}

.copy-btn:hover { background: var(--accent-green); color: black; }

.prompt-text {
    line-height: 1.4;
    white-space: pre-wrap; 
    word-break: break-word;
    margin-top: 4px;
}

.prompt-console.is-locked .prompt-text {
    filter: blur(4px);
    user-select: none;
    opacity: 0.6;
}

.prompt-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2;
}

.prompt-console.is-locked:hover .prompt-overlay { opacity: 1; }

.prompt-overlay span {
    background: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: white;
    border: 1px solid #333;
}

/* --- MODALS & PAGES --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--accent-green);
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.2);
    text-align: center;
}

.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.8rem; color: var(--text-muted); }
.form-input, .form-textarea {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 1px solid #333;
    color: white;
    border-radius: 6px;
}
.form-textarea { height: 100px; resize: vertical; font-family: var(--font-mono); font-size: 0.85rem; }
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--accent-green); }

.btn-google {
    margin-top: 15px;
    background: white;
    color: #333;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
}

/* PLANS PAGE */
#page-plans, #page-create { display: none; }

.plan-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 40px;
}

.plan-card {
    background: var(--card-bg);
    border: 1px solid var(--border-default);
    padding: 40px;
    border-radius: 16px;
    width: 300px;
    text-align: left;
    position: relative;
}

.plan-card.highlight {
    border-color: var(--accent-green);
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.1);
}

.plan-price { font-size: 2.5rem; font-weight: 800; color: white; margin: 20px 0; }
.plan-features li { margin-bottom: 10px; color: var(--text-muted); list-style: none; }
.plan-features li::before { content: "✓"; color: var(--accent-green); margin-right: 8px; }

/* UPLOAD AREA (MULTIPLE) */
.upload-area {
    border: 2px dashed var(--border-default);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    margin-bottom: 20px;
    position: relative;
}

.upload-area:hover, .upload-area.active {
    border-color: var(--accent-green);
    background: rgba(74, 222, 128, 0.05);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 20px;
    display: none; /* Hidden until files selected */
}

.preview-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-default);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* Notification */
.toast {
    position: fixed;
    bottom: 20px; right: 20px;
    background: var(--accent-green);
    color: #000;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transform: translateY(100px);
    transition: transform 0.3s ease;
    z-index: 3000;
}
.toast.show { transform: translateY(0); }

/* Mobile Nav */
@media (max-width: 768px) {
    .hero-title { font-size: 2.5rem; }
    .nav-pill { padding: 0.75rem 1rem; }
    .main-nav ul { gap: 1rem; }
    .main-nav span { display: none; }
}

/* --- Responsive navigation improvements --- */
/*
 * Introduce a hamburger button on small screens and collapse the nav by default.
 * The nav is only expanded when the `.open` class is applied via JavaScript.
 */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--accent-green);
}
@media (max-width: 768px) {
    .nav-pill {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    .nav-toggle {
        display: flex;
    }
    .main-nav {
        display: none;
        width: 100%;
        margin-top: 0.5rem;
    }
    .main-nav.open {
        display: block;
    }
    .main-nav ul {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    .main-nav a {
        font-size: 1.1rem;
        color: var(--accent-green);
        text-shadow: 0 0 6px var(--accent-green);
    }
    .main-nav a:hover::after {
        width: 0;
    }
    .main-nav a:hover {
        color: var(--accent-gold);
        text-shadow: 0 0 8px var(--accent-gold);
    }
}
