:root {
    --bg-deep: #0a0a0f;
    --bg-surface: #12121a;
    --bg-card: #1a1a25;
    --bg-hover: #22222f;
    --text-primary: #e8e8ed;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --accent-cyan: #00d4ff;
    --success: #4caf50;
    --error: #ff5252;
    --border: #2a2a35;
    --radius: 8px;
}

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

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-left h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Search section */
#search-section {
    margin-bottom: 40px;
}

.search-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#idea-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
}

#idea-input:focus {
    outline: none;
    border-color: var(--accent);
}

#idea-input::placeholder {
    color: var(--text-muted);
}

#submit-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 12px 24px;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    height: fit-content;
}

#submit-btn:hover {
    background: var(--accent-hover);
}

#submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#progress-container {
    margin-top: 12px;
}

/* Results */
#results-section {
    margin-bottom: 32px;
    padding: 16px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Ideas grid */
#my-ideas-heading {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
}

#ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.idea-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
}

.idea-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.idea-card-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--bg-surface);
    display: block;
}

.idea-card-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.idea-card-placeholder.generating {
    animation: pulse 1.5s ease-in-out infinite;
}

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

.idea-card-body {
    padding: 12px;
}

.idea-card-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.idea-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.version-badge {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

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

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
}

.modal-content h3 {
    margin-bottom: 12px;
    color: var(--accent-cyan);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.lightbox-content {
    background: var(--bg-surface);
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.lightbox-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.lightbox-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

#lightbox-image {
    width: 100%;
    display: block;
}

#lightbox-description {
    padding: 16px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

#lightbox-history {
    padding: 0 20px 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-version {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 4px;
}

.history-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(0, 212, 255, 0.1);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: var(--radius);
    transition: color 0.2s;
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-danger:hover {
    color: var(--error);
}

/* Auth area */
#auth-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

#auth-area .user-email {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

#auth-area button {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85rem;
}

#auth-area button:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .search-container {
        flex-direction: column;
    }
    #submit-btn {
        width: 100%;
    }
    .lightbox-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
