:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-glow: #60a5fa;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.6);
}

.top-nav {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 10;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.lang-switch select {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.profile-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    font-size: 0.9rem;
}

.user-credits {
    color: var(--accent-glow);
    font-weight: bold;
    cursor: pointer;
}

/* Display Section */
.display-section {
    width: 90%;
    /* display: flex; center content already set in parent */
    justify-content: center;
    align-items: center;
    min-height: 400px;
    /* Preserve space */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    margin-top: 2rem;
    position: relative;
    border: 1px solid var(--glass-border);
    animation: fadeIn 0.5s ease-out;
    display: flex;
    /* flex needed for centering svg placeholder */
}

/* Generated Image Styling */
.generated-image {
    max-height: 70vh;
    /* Fit height dimension */
    max-width: 100%;
    object-fit: contain;
    border-radius: 12px;
    /* border: 2px solid var(--accent-color); Removed per user request */
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.placeholder-content {
    position: absolute;
    /* Remove from flow */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    gap: 1rem;
    transition: opacity 0.3s ease;
    width: 100%;
    /* Ensure text doesn't wrap weirdly if tight */
    pointer-events: none;
    /* Let clicks pass through if needed */
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    /* Space below before prompt */
    position: relative;
    border: 1px solid var(--glass-border);
    /* Requested border */
    visibility: hidden;
    /* Reserve space */
}

.progress-container.visible {
    visibility: visible;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-glow));
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-color);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.logout-link {
    color: #ef4444;
    text-decoration: none;
    font-size: 0.7rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.plan-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 1px solid var(--accent-color);
}

.price-tag span {
    display: block;
    font-size: 1.5rem;
    font-weight: bd;
    color: var(--text-primary);
}

.upgrade-btn {
    margin-top: 1rem;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
    animation: pulse 10s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.05em;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

.input-section {
    width: 100%;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.input-wrapper {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.input-wrapper:focus-within {
    box-shadow: 0 0 0 2px var(--accent-color), 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.content-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center content */
}

/* Vertical Workflow Menu (Grid) */
.horizontal-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

/* Scrollbar styles removed as requested */

.horizontal-menu::-webkit-scrollbar {
    height: 6px;
}

.horizontal-menu::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.workflow-item {
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    /* Pill shape */
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    white-space: normal;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.workflow-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.workflow-item.selected {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.2);
}

.workflow-item .wf-name {
    font-weight: 600;
}

.workflow-item.selected .wf-name {
    color: var(--accent-glow);
}


/* Input Width 90% */
.input-section {
    width: 90%;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.input-wrapper {
    /* Existing styles preserved */
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}


/* History Strip */
.history-strip {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem;
    margin-top: 2rem;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    min-height: 120px;
    align-items: center;
}

.history-item {
    flex-shrink: 0;
    height: 100px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
}

.history-item img {
    height: 100%;
    border-radius: 8px;
}

/* Textarea Styling */
textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
    outline: none;
    font-family: inherit;
    resize: none;
    min-height: 80px;
    line-height: 1.5;
}

/* Scrollbar for textarea */
textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

textarea::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}


.pulse-text {
    animation: textPulse 0.5s ease;
}

@keyframes textPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
        color: #fff;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Dynamic Progress Overlay */
.dynamic-progress-overlay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    animation: fadeInDown 0.3s ease-out;
}

.node-progress-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.node-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.node-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.node-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.node-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-glow));
}

.queue-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 20;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: pulse 1.5s infinite;
}

.install-btn {
    background: linear-gradient(135deg, #2c4d42, #1b3f34);
    border: 1px solid #34d399;
    margin-right: 10px;
}

.install-btn:hover {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
/* Download Button Overlay (Main Image) */
.download-overlay-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 1.2rem;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 10;
}

.download-overlay-btn:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

/* History Item Styling for Button */
.history-item {
    position: relative; /* For absolute positioning of DL button */
}

.history-dl-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    text-decoration: none;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s;
    border: 1px solid rgba(255,255,255,0.3);
}

.history-item:hover .history-dl-btn {
    opacity: 1; /* Show on hover */
}

.history-dl-btn:hover {
    background: var(--accent-color);
}

/* Responsive Fix for Top Nav Overlap */
@media (max-width: 900px) {
    .top-nav {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        justify-content: center;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }

    .container {
        padding-top: 1rem;
        gap: 2rem;
    }

    header h1 {
        font-size: 2.5rem; /* Scale down title slightly */
    }
}
