:root {
    --primary: #FFE600;
    --primary-hover: #E6CF00;
    --bg-dark: #050505;
    --bg-card: #111111;
    --bg-input: #1A1A1A;
    --text-main: #FFFFFF;
    --text-muted: #999999;
    --border: #262626;
    --border-hover: #404040;
    --danger: #FF4545;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --header-height: 72px;
    --nav-height-mobile: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Nav */
.app-header {
    height: var(--header-height);
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
}

.header-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0;
    justify-content: flex-start;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s;
}

.header-logo:hover {
    transform: scale(1.05);
}

.brand-section h1 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.badge {
    font-size: 0.6rem;
    font-weight: 800;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
}

.main-nav {
    display: flex;
    gap: 8px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn svg {
    width: 16px;
    height: 16px;
}

.nav-btn:hover {
    color: var(--text-main);
}

.nav-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Main Content Area */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 24px;
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

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

/* Creation Grid Layout */
.creation-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
}

.input-column {
    display: flex;
    flex-direction: column;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.view-section.active {
    display: block;
}

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

/* Creation Grid Layout */
.creation-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
}

/* Cards & Inputs */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.card-header-mini h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Upload Rows */
.upload-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.upload-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.drop-zone.compact {
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.drop-zone.compact:hover {
    border-color: var(--primary);
    background: rgba(255, 230, 0, 0.02);
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.plus-icon {
    font-size: 24px;
    color: var(--primary);
    font-weight: 300;
}

.drop-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 16px;
    border-radius: 100px; /* Pill shape */
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    box-shadow: 0 0 20px rgba(255, 230, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.generate-btn:hover:not(:disabled) {
    transform: scale(1.02);
    background: #FFF04D;
    box-shadow: 0 0 30px rgba(255, 230, 0, 0.2);
}

.generate-btn:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Results Area */
.output-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* Project Grouping */
.project-group {
    margin-bottom: 32px;
}

.project-group-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.project-group-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.result-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/9;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: fadeImg 0.5s ease forwards;
}

@keyframes fadeImg {
    to { opacity: 1; }
}

.download-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}

.download-btn:hover {
    background: var(--primary);
    color: #000;
}

/* Recent History Grid */
.recent-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.recent-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.recent-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 230, 0, 0.2);
}

.recent-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.recent-item:hover .recent-item-actions {
    opacity: 1;
}

.recent-download-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-download-btn:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Gallery View */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.gallery-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.history-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.history-item:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.history-item:hover::before {
    transform: scaleX(1);
}

/* Gallery Actions */
.gallery-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.clear-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(255, 69, 69, 0.05);
}

.history-item-delete {
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.history-item-delete:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(255, 69, 69, 0.1);
}

.history-item-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}

.history-item-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.history-item-images img {
    cursor: pointer;
    transition: all 0.2s;
}

.history-item-images img:hover {
    border-color: var(--primary);
    transform: scale(1.08);
    z-index: 1;
    box-shadow: 0 4px 12px rgba(255, 230, 0, 0.2);
}

/* Gallery Modal */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.gallery-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.gallery-modal-content {
    position: relative;
    z-index: 2;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.gallery-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.gallery-image-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.gallery-download-btn,
.gallery-edit-btn {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border: 2px solid var(--primary);
    border-radius: 100px;
    color: var(--primary);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10;
}

.gallery-download-btn:hover,
.gallery-edit-btn:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 230, 0, 0.4);
}

.gallery-download-btn svg,
.gallery-edit-btn svg {
    width: 18px;
    height: 18px;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

.gallery-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

.gallery-nav:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav-prev {
    left: 20px;
}

.gallery-nav-next {
    right: 20px;
}

.gallery-counter {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

/* Gallery Thumbnails */
.gallery-thumbnails {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    max-width: 100%;
    overflow-x: auto;
    padding: 10px 0;
}

.gallery-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    opacity: 0.6;
}

.gallery-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-thumb.active {
    border-color: var(--primary);
    opacity: 1;
    box-shadow: 0 0 12px rgba(255, 230, 0, 0.4);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-download {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.gallery-thumb:hover .thumb-download {
    opacity: 1;
}

.thumb-download:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* Recent Item Overlay */
.recent-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.recent-item-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

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

.help-modal-content {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.help-modal-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--primary);
}

.help-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.help-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.help-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.step-content p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.help-tips {
    background: rgba(255, 230, 0, 0.05);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 24px;
}

.help-tips h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary);
}

.help-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-tips li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-muted);
    line-height: 1.6;
}

.help-tips li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

/* Guided Tour Styles */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9998;
    cursor: pointer;
}

.tour-highlight {
    position: relative;
    z-index: 9999 !important;
    outline: 3px solid var(--primary) !important;
    outline-offset: 4px;
    box-shadow: 0 0 0 4px rgba(255, 230, 0, 0.3), 0 0 20px rgba(255, 230, 0, 0.5) !important;
    border-radius: var(--radius-md);
    animation: pulseHighlight 2s ease-in-out infinite;
}

@keyframes pulseHighlight {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(255, 230, 0, 0.3), 0 0 20px rgba(255, 230, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 230, 0, 0.5), 0 0 30px rgba(255, 230, 0, 0.7);
    }
}

.tour-tooltip {
    position: fixed;
    z-index: 10000;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 0;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 4px rgba(255, 230, 0, 0.2);
    animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 230, 0, 0.05);
}

.tour-step-indicator {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tour-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.tour-close:hover {
    color: var(--text-main);
}

.tour-tooltip-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 16px 16px 8px;
}

.tour-tooltip-description {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 16px 16px;
    font-size: 0.95rem;
}

.tour-tooltip-actions {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    justify-content: flex-end;
}

.tour-btn {
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.tour-btn-primary {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

.tour-btn-primary:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.tour-btn-secondary {
    background: transparent;
    color: var(--text-main);
}

.tour-btn-secondary:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
}

/* History image clickable */
.history-image-clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.history-image-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 230, 0, 0.3);
}

/* Project Name Field */
.project-name-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.project-name-wrapper input {
    flex: 1;
}

.project-name-btn {
    padding: 0 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.project-name-btn:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    color: var(--primary);
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Gallery Image Actions */
.gallery-image-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.gallery-edit-btn {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.gallery-edit-btn:hover {
    background: var(--primary);
    color: #000;
    transform: scale(1.05);
}

/* Edit Menu Modal */
.edit-menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
}

.edit-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.edit-menu-content {
    position: relative;
    background: var(--bg-dark);
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: 95vw;
    width: 100%;
    max-height: 95vh;
    height: 95vh;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}

.edit-menu-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.edit-menu-close:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary);
    color: var(--primary);
}

/* Header with dropdown */
.edit-menu-header {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
}

.edit-mode-select {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-mode-select:hover {
    border-color: var(--primary);
}

.edit-mode-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Main Image Viewer */
.edit-image-viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-dark);
    padding: 60px 20px 100px;
}

.original-image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.original-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Bottom Control Bar */
.edit-control-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10;
}

.edit-control-left {
    flex: 1;
    min-width: 0;
}

.edit-control-left textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    transition: all 0.2s;
}

.edit-control-left textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
}

.edit-control-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.edit-add-image-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.edit-add-image-btn:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    color: var(--primary);
}

.edit-model-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-model-select:hover {
    border-color: var(--primary);
}

.edit-model-select:focus {
    outline: none;
    border-color: var(--primary);
}

.edit-control-right {
    display: flex;
    align-items: center;
}

.edit-btn-generate {
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    color: #000;
    padding: 10px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.edit-btn-generate:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.edit-btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Reference Images Preview */
.edit-refs-preview {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9;
}

.edit-refs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.edit-refs-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.edit-refs-close:hover {
    color: var(--text-main);
}

.edit-refs-preview .preview-container {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.edit-refs-preview .preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
}

.edit-refs-preview .preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-refs-preview .preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: var(--text-main);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.edit-refs-preview .preview-item:hover .preview-remove {
    opacity: 1;
}

.edit-refs-preview .preview-remove:hover {
    background: var(--danger);
    color: #fff;
}

/* Mobile adjustments for edit modal */
@media (max-width: 768px) {
    .edit-menu-content {
        max-width: 100vw;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
    }
    
    .edit-control-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .edit-control-left,
    .edit-control-center,
    .edit-control-right {
        width: 100%;
    }
    
    .edit-control-center {
        justify-content: space-between;
    }
    
    .edit-btn-generate {
        width: 100%;
        justify-content: center;
    }
    
    .edit-image-viewer {
        padding: 40px 10px 180px;
    }
    
    .edit-refs-preview {
        bottom: 140px;
        left: 10px;
        right: 10px;
        max-height: 150px;
    }
}

.edit-btn-cancel {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn-cancel:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
}

.edit-btn-generate {
    padding: 12px 24px;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 100px;
    color: #000;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-btn-generate:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.edit-btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Custom Scrollbar - EventVision Theme */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-left: 1px solid var(--border);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-input);
    border: 2px solid var(--bg-dark);
    border-radius: 6px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-input) var(--bg-dark);
}

/* Scrollbar for specific containers */
.help-modal-content::-webkit-scrollbar,
.gallery-modal-content::-webkit-scrollbar,
.history-container::-webkit-scrollbar {
    width: 8px;
}

.help-modal-content::-webkit-scrollbar-thumb,
.gallery-modal-content::-webkit-scrollbar-thumb,
.history-container::-webkit-scrollbar-thumb {
    background: var(--bg-input);
    border-radius: 4px;
}

.help-modal-content::-webkit-scrollbar-thumb:hover,
.gallery-modal-content::-webkit-scrollbar-thumb:hover,
.history-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Make result items clickable */
.result-item {
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.result-item img {
    pointer-events: none;
}

/* Generation Status */
.generation-status {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.status-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.status-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.status-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 100px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

/* Preview Items */
.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.preview-item {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.preview-item:hover .remove-btn {
    opacity: 1;
}

/* Cards & Panels */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--primary);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.section-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.drop-zone {
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(255, 230, 0, 0.02);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(255, 230, 0, 0.05);
    transform: scale(0.99);
}

.drop-zone-content {
    pointer-events: none;
}

.icon-circle {
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: var(--text-muted);
    transition: var(--transition);
}

.drop-zone:hover .icon-circle {
    color: var(--primary);
    transform: scale(1.1);
}

.drop-zone p {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.action-area {
    margin-top: 8px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
}

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

.recent-history-section {
    margin-top: 0;
}

.empty-history {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .app-header {
        position: fixed;
        bottom: 0;
        top: auto;
        height: var(--nav-height-mobile);
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        border-bottom: none;
        padding: 0;
    }

    .header-content {
        justify-content: center;
        padding: 0;
    }

    .brand-section {
        display: none; /* Hide logo on mobile nav bar */
    }

    .main-nav {
        width: 100%;
        justify-content: space-around;
        background: transparent;
        border: none;
        border-radius: 0;
        height: 100%;
    }

    .nav-btn {
        flex-direction: column;
        gap: 4px;
        font-size: 0.7rem;
        padding: 0;
        width: 100%;
        justify-content: center;
        border-radius: 0;
    }
    
    .nav-btn.active {
        background: transparent;
        box-shadow: none;
        color: var(--primary);
    }

    /* Mobile Header Logo Area */
    .app-container::before {
        content: 'EventVision';
        display: flex;
        align-items: center;
        justify-content: center;
        height: 60px;
        background: rgba(5, 5, 5, 0.8);
        backdrop-filter: blur(12px);
        font-weight: 800;
        font-size: 1.1rem;
        color: var(--text-main);
        position: sticky;
        top: 0;
        z-index: 99;
        border-bottom: 1px solid var(--border);
        width: 100%;
    }

    /* Main Content Adjustments for Bottom Nav */
    .main-content {
        padding: 16px;
        padding-bottom: calc(var(--nav-height-mobile) + 24px);
        padding-top: calc(60px + 16px);
    }

    .creation-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .upload-row {
        grid-template-columns: 1fr; /* Stack uploads on mobile */
    }

    .drop-zone {
        min-height: 120px;
    }

    .generate-btn {
        position: fixed;
        bottom: calc(var(--nav-height-mobile) + 16px);
        left: 16px;
        right: 16px;
        width: calc(100% - 32px);
        z-index: 90;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }
    
    /* Ensure content doesn't hide behind fixed button */
    .input-column {
        padding-bottom: 60px; 
    }

    /* Gallery Modal Mobile */
    .gallery-nav {
        width: 40px;
        height: 40px;
    }

    .gallery-nav-prev {
        left: 10px;
    }

    .gallery-nav-next {
        right: 10px;
    }

    .gallery-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .gallery-modal-content img {
        max-height: 80vh;
    }

    .gallery-image-actions {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        gap: 8px;
    }

    .gallery-download-btn,
    .gallery-edit-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .gallery-download-btn span,
    .gallery-edit-btn span {
        display: none;
    }

    .gallery-download-btn,
    .gallery-edit-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .history-container {
        grid-template-columns: 1fr;
    }

    /* Recent items mobile - always show download button */
    .recent-item-actions {
        opacity: 1 !important;
    }

    .recent-download-btn {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(12px);
    }

    .recent-item-overlay {
        padding: 12px 8px;
    }

    /* Tour Mobile */
    .tour-tooltip {
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px;
        width: auto;
    }

    .tour-tooltip-title {
        font-size: 1.1rem;
    }

    .tour-tooltip-description {
        font-size: 0.9rem;
    }

    .tour-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
