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

:root {
    --primary-red: #FF3B30;
    --secondary-orange: #FF9500;
    --accent-gradient: linear-gradient(135deg, #FF3B30, #FF9500);
    --dark-bg: #0a0a0a;
    --card-bg: #141414;
    --card-hover: #1a1a1a;
    --border-color: #2a2a2a;
    --border-hover: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-muted: #666666;
}

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

.sidebar-logo,
.header-logo,
.logo {
    font-family: 'Righteous', sans-serif;
    font-size: 1.35rem;
}

.sidebar-logo svg,
.header-logo svg,
.logo svg {
    width: 32px;
    height: 32px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header - Fixed at top */
.header {
    position: sticky;
    top: 0;
    z-index: 101;
    background: var(--dark-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0 3rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-red), var(--secondary-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo svg {
    color: var(--primary-red);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s;
}

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

.btn-signin {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.7rem 1.8rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-signin:hover {
    background: var(--card-bg);
    border-color: var(--primary-red);
    color: var(--primary-red);
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    max-width: 900px;
    margin: 0 auto;
}

.get-started {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    letter-spacing: 0.5px;
}

/* Action Tabs */
.action-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    background: rgba(20, 20, 20, 0.6);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.9rem 1.6rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(10px);
}

.tab-btn:hover {
    background: rgba(26, 26, 26, 0.8);
    border-color: rgba(255, 59, 48, 0.3);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.tab-btn svg {
    width: 20px;
    height: 20px;
}

/* Prompt Box */
.prompt-box {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.8), rgba(26, 26, 26, 0.6));
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 4rem;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
}

.prompt-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3), rgba(255, 149, 0, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.prompt-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 60px rgba(255, 59, 48, 0.15);
}

.prompt-box:hover::before {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.6), rgba(255, 149, 0, 0.6));
}

.prompt-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-family: inherit;
    resize: none;
    min-height: 140px;
    outline: none;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-weight: 400;
}

.prompt-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.prompt-options {
    display: flex;
    gap: 0.75rem;
}

.option-btn {
    background: rgba(10, 10, 10, 0.6);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.3rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.option-btn:hover {
    background: rgba(20, 20, 20, 0.8);
    border-color: rgba(255, 59, 48, 0.4);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.option-btn svg {
    width: 18px;
    height: 18px;
}

.prompt-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.icon-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--card-bg);
    transform: translateY(-2px);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.enhance-text {
    font-size: 0.9rem;
}

.generate-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.9rem 2.2rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(255, 59, 48, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.generate-btn:active {
    transform: translateY(-1px);
}

.generate-btn svg {
    width: 18px;
    height: 18px;
}

/* Gallery Section */
.gallery-section {
    margin-top: 5rem;
}

.gallery-title {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.gallery-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s ease;
    cursor: pointer;
}

.gallery-item:hover {
    border-color: var(--primary-red);
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(255, 59, 48, 0.2);
}

.thumbnail-placeholder {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 3rem;
    text-align: center;
}



/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0;
    }

    .header {
        flex-direction: row;
        gap: 0.75rem;
        align-items: center;
        padding: 1rem 0.875rem;
        justify-content: space-between;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .header-logo {
        font-size: 1.125rem;
        font-weight: 700;
    }

    .header-logo img {
        width: 28px;
        height: 28px;
    }

    .nav {
        gap: 0.625rem;
    }

    .nav-link {
        display: none;
    }

    .btn-signin {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        border-radius: 10px;
        font-weight: 600;
    }

    .get-started {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .action-tabs {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .tab-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
        gap: 0.5rem;
    }

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

    /* Prompt Box Mobile */
    .prompt-box {
        padding: 1.5rem;
        border-radius: 20px;
        margin-bottom: 2.5rem;
    }

    .prompt-input {
        font-size: 0.95rem;
        min-height: 100px;
        margin-bottom: 1rem;
    }

    .prompt-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .prompt-options {
        justify-content: center;
        gap: 0.5rem;
    }

    .option-btn {
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
        flex: 1;
    }

    .prompt-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .icon-btn {
        width: 100%;
        justify-content: center;
        padding: 0.7rem;
    }

    .enhance-text {
        font-size: 0.85rem;
    }

    .generate-btn {
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Recreate Box Mobile */
    .recreate-box {
        padding: 1.5rem;
        gap: 1.5rem;
        margin-bottom: 2.5rem;
    }

    .upload-tabs {
        gap: 0.5rem;
    }

    .upload-tab {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
        flex: 1;
    }

    .link-input {
        padding: 1rem 1.2rem;
        font-size: 0.9rem;
    }

    .recreate-options {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .recreate-option-btn {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
        flex: 1;
        min-width: calc(50% - 0.375rem);
    }

    .section-label {
        font-size: 0.9rem;
    }

    .edits-input {
        padding: 1rem 1.2rem;
        font-size: 0.9rem;
        min-height: 80px;
    }

    /* Edit Box Mobile */
    .edit-box {
        padding: 1.5rem;
        gap: 1.5rem;
        margin-bottom: 2.5rem;
    }

    .edit-upload-tabs {
        gap: 0.5rem;
    }

    .edit-upload-tab {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
        flex: 1;
    }

    .upload-area {
        padding: 1.5rem 1rem;
    }

    .upload-content {
        gap: 0.5rem;
    }

    .upload-icon {
        width: 36px;
        height: 36px;
    }

    .upload-text {
        font-size: 0.9rem;
    }

    .upload-subtext {
        font-size: 0.8rem;
    }

    /* Gallery Mobile */
    .gallery-section {
        margin-top: 3rem;
    }

    .gallery-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* Recreate Mode */
.recreate-box {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.8), rgba(26, 26, 26, 0.6));
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 4rem;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.recreate-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3), rgba(255, 149, 0, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.recreate-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 60px rgba(255, 59, 48, 0.15);
}

.recreate-box:hover::before {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.6), rgba(255, 149, 0, 0.6));
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-tabs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.upload-tab {
    background: rgba(10, 10, 10, 0.6);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.upload-tab:hover {
    background: rgba(20, 20, 20, 0.8);
    border-color: rgba(255, 59, 48, 0.4);
    color: var(--text-primary);
}

.upload-tab.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
}

.link-input {
    width: 100%;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding: 1.2rem 1.5rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
}

.link-input::placeholder {
    color: var(--text-muted);
}

.link-input:focus {
    border-color: rgba(255, 59, 48, 0.5);
    background: rgba(15, 15, 15, 0.8);
}

.recreate-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.recreate-option-btn {
    background: rgba(10, 10, 10, 0.6);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.recreate-option-btn:hover {
    background: rgba(20, 20, 20, 0.8);
    border-color: rgba(255, 59, 48, 0.4);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.personas-section,
.edits-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.section-label svg {
    width: 18px;
    height: 18px;
    color: var(--primary-red);
}

.edits-input {
    width: 100%;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding: 1.2rem 1.5rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 100px;
    outline: none;
    transition: all 0.3s ease;
}

.edits-input::placeholder {
    color: var(--text-muted);
}

.edits-input:focus {
    border-color: rgba(255, 59, 48, 0.5);
    background: rgba(15, 15, 15, 0.8);
}

.recreate-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Edit Mode */
.edit-box {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.8), rgba(26, 26, 26, 0.6));
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 4rem;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.edit-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3), rgba(255, 149, 0, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.edit-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 60px rgba(255, 59, 48, 0.15);
}

.edit-box:hover::before {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.6), rgba(255, 149, 0, 0.6));
}

.edit-upload-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.edit-upload-tabs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.edit-upload-tab {
    background: rgba(10, 10, 10, 0.6);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
}

.edit-upload-tab:hover {
    background: rgba(20, 20, 20, 0.8);
    border-color: rgba(255, 59, 48, 0.4);
    color: var(--text-primary);
}

.edit-upload-tab.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
}

.soon-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(10, 10, 10, 0.4);
    min-height: 120px;
    max-height: 160px;
    overflow: hidden;
}

.upload-area:hover {
    border-color: rgba(255, 59, 48, 0.5);
    background: rgba(15, 15, 15, 0.6);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-red);
}

.upload-text {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
}

.upload-subtext {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.edit-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Persona Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Persona List Modal */
.persona-list-modal {
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 59, 48, 0.06), transparent 60%),
        linear-gradient(145deg, rgba(26, 26, 26, 1), rgba(20, 20, 20, 1));
    border: 1px solid rgba(255, 100, 80, 0.15);
    border-radius: 20px;
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(255, 59, 48, 0.08);
}

.modal-overlay.active .persona-list-modal,
.modal-overlay.active .create-persona-modal {
    transform: scale(1);
}

.modal-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 2rem;
    border-bottom: 1px solid rgba(255, 100, 80, 0.12);
    background: rgba(22, 22, 22, 0.6);
}

.modal-title-main {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FF3B30, #FF9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.persona-list-content {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.create-persona-card {
    position: relative;
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 149, 0, 0.06), transparent 70%),
        linear-gradient(145deg, rgba(32, 30, 28, 1), rgba(26, 25, 24, 1));
    border: 2px dashed rgba(255, 149, 0, 0.25);
    border-radius: 18px;
    padding: 2.5rem 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    min-height: 200px;
    overflow: hidden;
}

.create-persona-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
    opacity: 1;
    transition: opacity 0.3s;
    pointer-events: none;
}

.create-persona-card:hover {
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 149, 0, 0.1), transparent 70%),
        linear-gradient(145deg, rgba(36, 32, 30, 1), rgba(30, 28, 26, 1));
    border-color: rgba(255, 149, 0, 0.4);
    transform: translateY(-4px);
    box-shadow: 
        0 12px 32px rgba(255, 149, 0, 0.15),
        0 0 40px rgba(255, 149, 0, 0.08);
}

.create-persona-card svg {
    color: rgba(255, 180, 120, 0.6);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.create-persona-card:hover svg {
    color: rgba(255, 200, 140, 0.9);
    transform: scale(1.1) rotate(90deg);
}

.create-persona-text {
    font-size: 1rem;
    color: rgba(255, 200, 140, 0.85);
    font-weight: 600;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

.create-persona-card:hover .create-persona-text {
    color: rgba(255, 220, 160, 1);
}

/* Create Persona Modal */
.create-persona-modal {
    background: #1a1a1a;
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.create-persona-content {
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.cost-notice {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.cost-notice svg {
    color: var(--primary-red);
    flex-shrink: 0;
}

.cost-notice strong {
    color: var(--primary-red);
    font-weight: 700;
}

.profile-picture-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.section-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.profile-upload-circle {
    width: 180px;
    height: 180px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.profile-upload-circle:hover {
    border-color: var(--primary-red);
    background: rgba(255, 59, 48, 0.05);
}

.profile-upload-circle svg {
    color: var(--text-secondary);
}

.upload-circle-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.profile-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

.persona-name-section {
    display: flex;
    flex-direction: column;
}

.persona-name-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.persona-name-input::placeholder {
    color: var(--text-muted);
}

.persona-name-input:focus {
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.08);
}

.additional-photos-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.photo-counter {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.photo-slot {
    aspect-ratio: 1;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.photo-slot:hover {
    border-color: var(--primary-red);
    background: rgba(255, 59, 48, 0.05);
}

.photo-slot svg {
    color: var(--text-secondary);
}

.photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.create-persona-submit-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.25);
}

.create-persona-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(255, 59, 48, 0.4);
}

.create-persona-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}



/* Mobile Modal */
@media (max-width: 768px) {
    .persona-modal {
        padding: 2rem 1.5rem;
        width: 95%;
    }

    .modal-header {
        margin-bottom: 2rem;
    }

    .modal-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 1rem;
    }

    .modal-icon svg {
        width: 28px;
        height: 28px;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .persona-upload-area {
        padding: 2rem 1.5rem;
    }

    .persona-upload-icon {
        width: 40px;
        height: 40px;
    }

    .persona-upload-title {
        font-size: 0.95rem;
    }

    .persona-upload-subtitle {
        font-size: 0.85rem;
    }

    .modal-generate-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: rgba(10, 10, 10, 0.95);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo svg {
    color: var(--primary-red);
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.sidebar-toggle:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.sidebar-menu-top {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-menu-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
    text-align: left;
}

.sidebar-menu-item:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.sidebar-menu-item svg {
    width: 18px;
    height: 18px;
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-left: 1rem;
}

.sidebar-submenu-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
    text-align: left;
}

.sidebar-submenu-item:hover {
    background: rgba(20, 20, 20, 0.6);
    color: var(--text-primary);
}

.sidebar-submenu-item svg {
    width: 16px;
    height: 16px;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--dark-bg);
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

.header-logo {
    display: none;
}

/* Mobile Sidebar */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .header-logo {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 1.25rem;
        font-weight: 700;
        background: var(--accent-gradient);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .header-logo svg {
        color: var(--primary-red);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 90;
        background: var(--dark-bg);
    }

    .nav {
        gap: 0.5rem;
    }

    .nav-link {
        display: none;
    }

    .btn-signin {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .container {
        padding: 1rem;
        padding-top: 0;
    }

    .main-content {
        padding-top: 1rem;
    }
}

/* Spinning animation for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 1s linear infinite;
}

/* Download button for thumbnails */
.download-thumbnail-btn {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.75rem;
    transition: all 0.3s;
}

.download-thumbnail-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 59, 48, 0.3);
}

.gallery-item img {
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.02);
}

/* Credits Badge in Nav */
.nav-credits {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 149, 0, 0.1);
    /* Low opacity orange background */
    border: 1px solid rgba(255, 149, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: var(--secondary-orange);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.1);
}

.nav-credits svg {
    width: 20px;
    height: 20px;
}

/* Mobile Improvements */
@media (max-width: 768px) {
    .header {
        position: relative;
        justify-content: space-between;
        padding-right: 1rem;
        /* Ensure space for logout button */
    }

    .logo,
    .header-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
    }

    /* Hide text, show icon for Log Out button on mobile */
    .btn-signin .btn-text {
        display: none;
    }

    .btn-signin .btn-icon {
        display: block !important;
    }

    .btn-signin {
        padding: 0.5rem;
        /* Reduce padding for icon-only button */
        border-radius: 50%;
        /* Optional: make it circular if desired, or just smaller rounded rect */
        aspect-ratio: 1/1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust nav spacing */
    .nav {
        gap: 0.75rem;
    }

    .nav-link {
        display: none;
        /* Already hidden in existing media query, just ensuring */
    }

    /* Ensure credits fit */
    .nav-credits {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

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

/* Spinning animation for loading states */
@keyframes spinning {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spinning 1s linear infinite;
}

/* Chat-style interface */
.chat-container {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    overflow-y: auto;
}

.chat-container:empty {
    display: none;
}

@media (min-width: 768px) {
    .chat-container {
        padding: 2rem 1rem;
        gap: 2rem;
        max-width: 1200px;
        margin: 0 auto;
    }
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
    gap: 1.25rem;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-prompt {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    width: 100%;
    backdrop-filter: blur(10px);
}

@media (min-width: 768px) {
    .user-prompt {
        border-radius: 16px;
        padding: 1.25rem 1.5rem;
        font-size: 1rem;
        line-height: 1.7;
        max-width: 900px;
        margin: 0 auto;
    }
}

.ai-response {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
    gap: 1rem;
}

.loading-indicator {
    display: flex;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    width: 100%;
    backdrop-filter: blur(10px);
}

@media (min-width: 768px) {
    .loading-indicator {
        padding: 2rem;
        border-radius: 20px;
        max-width: 900px;
        margin: 0 auto;
    }
}

.loading-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #FF3B30, #FF9500, #FF3B30);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: loadingProgress 2s ease-in-out infinite, shimmer 1.5s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    flex: 1;
    min-width: 0;
    font-weight: 500;
    white-space: nowrap;
}

.generated-image {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.4);
    width: 100%;
    margin: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.generated-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
}

.generated-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

@media (min-width: 768px) {
    .generated-image {
        max-width: 900px;
        margin: 0 auto;
        border-radius: 20px;
    }
}

.image-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: transparent;
    border-top: none;
}

.image-action-btn {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 59, 48, 0.3);
    color: var(--text-primary);
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 48px;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.15), 0 0 0 1px rgba(255, 59, 48, 0.1);
}

.image-action-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.6);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.35), 0 0 0 2px rgba(255, 59, 48, 0.2);
}

.image-action-btn:active {
    transform: translateY(0) scale(0.98);
}

.image-action-btn svg {
    transition: transform 0.3s ease;
}

.image-action-btn:hover svg {
    transform: scale(1.1);
}

@media (min-width: 768px) {
    .image-actions {
        padding: 1.5rem;
        gap: 1rem;
    }

    .image-action-btn {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
        min-width: 56px;
    }
}

/* Input container - fixed at bottom after first generation */
.input-container {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.8), rgba(26, 26, 26, 0.6));
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: 24px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 900px;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    z-index: 1;
    box-sizing: border-box;
    overflow: hidden;
}

.input-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3), rgba(255, 149, 0, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.input-container.has-messages {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    margin: 0;
    z-index: 90;
    background: var(--card-bg);
    border: none;
    border-radius: 24px 24px 0 0;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    max-width: 100%;
}

.input-container.has-messages::before {
    display: none;
}

@media (min-width: 768px) {
    .input-container.has-messages .prompt-box {
        padding: 0.625rem 1rem;
    }
}

.input-container.has-messages .action-tabs {
    display: flex;
    /* Keep tabs visible when fixed */
    margin-bottom: 0.5rem;
}



.input-container.has-messages .prompt-input {
    min-height: 52px;
    max-height: 120px;
    font-size: 0.9rem;
    padding: 0.875rem;
    resize: none;
    overflow-y: auto;
    line-height: 1.5;
}

.input-container.has-messages .prompt-footer {
    padding: 0.5rem 0 0;
    gap: 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
}

.input-container.has-messages .prompt-options {
    display: flex;
    gap: 0.5rem;
    order: 1;
}

.input-container.has-messages .prompt-actions {
    gap: 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    order: 2;
}

.input-container.has-messages .option-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
    border-radius: 20px;
}

.input-container.has-messages .icon-btn {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.input-container.has-messages .icon-btn svg {
    width: 20px;
    height: 20px;
}

.input-container.has-messages .icon-btn .enhance-text {
    display: none;
}

.input-container.has-messages .generate-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 24px;
}

.input-container.has-messages .generate-btn svg {
    width: 18px;
    height: 18px;
}

@media (min-width: 768px) {
    .input-container {
        padding: 1.5rem;
    }

    .input-container.has-messages {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 1024px) {
    .input-container.has-messages {
        left: 0;
    }
}

@media (min-width: 1024px) {
    .input-container.has-messages {
        left: 280px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Ensure chat container also respects sidebar */
@media (min-width: 1024px) {
    .main-content {
        padding-left: 1rem;
    }

    .input-container {
        margin-top: -6rem;
    }
}

.main-content {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    overflow-y: auto;
    padding-bottom: 0;
}

.main-content.has-messages {
    padding-bottom: 200px;
    /* Space for fixed compact input */
}

.get-started {
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    transition: all 0.3s;
}

.get-started.hidden {
    display: none;
}

@media (min-width: 768px) {
    .main-content.has-messages {
        padding-bottom: 220px;
    }
}


/* Recreate and Edit prompt inputs */
.recreate-prompt-input,
.edit-prompt-input {
    width: 100%;
    min-height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    margin: 1rem 0;
}

.recreate-prompt-input::placeholder,
.edit-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.recreate-prompt-input:focus,
.edit-prompt-input:focus {
    outline: none;
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.08);
}


/* Add spacing to recreate sections */
.recreate-box .upload-section {
    margin-bottom: 1.5rem;
}

.recreate-box .recreate-options {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.edit-box .edit-upload-section {
    margin-bottom: 1.5rem;
}

/* Mobile Persona Modals */
@media (max-width: 768px) {

    .persona-list-modal,
    .create-persona-modal {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header-bar {
        padding: 1.25rem 1.5rem;
    }

    .modal-title-main {
        font-size: 1.25rem;
    }

    .persona-list-content {
        padding: 1.5rem;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .create-persona-content {
        padding: 1.5rem;
    }

    .profile-upload-circle {
        width: 150px;
        height: 150px;
    }

    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}


/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-content svg {
    color: var(--primary-red);
    flex-shrink: 0;
}

.toast-message {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .toast-notification {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(150%);
    }

    .toast-notification.show {
        transform: translateX(0) translateY(0);
    }
}


/* Link Input with Fetch Button */
.link-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.link-input-wrapper .link-input {
    flex: 1;
    min-width: 0;
    /* Allow flex item to shrink below content size */
    box-sizing: border-box;
}

.fetch-link-btn {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: var(--primary-red);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.fetch-link-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: var(--primary-red);
    transform: translateX(2px);
}

.fetch-link-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.fetch-link-btn svg {
    transition: transform 0.3s ease;
}

.fetch-link-btn:hover:not(:disabled) svg {
    transform: translateX(2px);
}


/* Edit Tools Section */
.edit-tools-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.edit-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
}

.edit-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.mask-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    cursor: default;
}

.mask-canvas.active {
    pointer-events: all;
    cursor: crosshair;
}

.edit-mode-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.edit-mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-mode-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.edit-mode-tab.active {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.edit-mode-tab svg {
    width: 20px;
    height: 20px;
}

.edit-controls,
.faceswap-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.brush-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brush-size-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brush-size-control label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 80px;
}

.brush-size-control input[type="range"] {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.brush-size-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-red);
    border-radius: 50%;
    cursor: pointer;
}

.brush-size-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-red);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.brush-size-control span {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    min-width: 50px;
}

.clear-mask-btn {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: var(--primary-red);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-mask-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: var(--primary-red);
}

.persona-select-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.persona-select-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.selected-persona {
    padding: 1rem;
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.3);
    border-radius: 10px;
    color: #34C759;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.edit-prompt-input {
    width: 100%;
    min-height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.3s ease;
}

.edit-prompt-input::placeholder {
    color: var(--text-muted);
}

.edit-prompt-input:focus {
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
    .edit-mode-tabs {
        gap: 0.25rem;
    }

    .edit-mode-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .edit-mode-tab svg {
        width: 18px;
        height: 18px;
    }

    .brush-size-control {
        flex-direction: column;
        align-items: stretch;
    }

    .brush-size-control label {
        min-width: auto;
    }
}


/* Upgrade Button */
.upgrade-btn {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
}

.upgrade-btn svg {
    width: 20px;
    height: 20px;
}


/* Account Modal */
.account-modal {
    background: #1a1a1a;
    border-radius: 16px;
    max-width: 450px;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .account-modal {
    transform: scale(1);
}

.account-modal-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.account-avatar {
    width: 100px;
    height: 100px;
    background: rgba(255, 59, 48, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 59, 48, 0.3);
}

.account-avatar svg {
    color: var(--primary-red);
}

.account-info {
    text-align: center;
    width: 100%;
}

.account-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.account-email {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.account-credits-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.credits-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.credits-amount {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.buy-credits-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
}

.buy-credits-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
}

.logout-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

@media (max-width: 768px) {
    .account-modal {
        width: 95%;
    }

    .account-modal-content {
        padding: 1.5rem;
    }

    .account-avatar {
        width: 80px;
        height: 80px;
    }

    .account-avatar svg {
        width: 48px;
        height: 48px;
    }

    .account-name {
        font-size: 1.25rem;
    }

    .credits-amount {
        font-size: 2rem;
    }
}


/* My Plans Modal */
.my-plans-modal {
    background: #1a1a1a;
    border-radius: 16px;
    max-width: 550px;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .my-plans-modal {
    transform: scale(1);
}

.my-plans-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.plan-status-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.plan-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 59, 48, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 59, 48, 0.3);
}

.plan-icon svg {
    color: var(--primary-red);
}

.plan-name-display {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.plan-status-text {
    font-size: 0.9rem;
    color: #34C759;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: rgba(52, 199, 89, 0.1);
    border-radius: 20px;
}

.plan-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.plan-detail-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.detail-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.upgrade-plan-btn {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
}

.upgrade-plan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
}

@media (max-width: 768px) {
    .my-plans-modal {
        width: 95%;
    }

    .my-plans-content {
        padding: 1.5rem;
    }

    .plan-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .plan-icon {
        width: 64px;
        height: 64px;
    }

    .plan-icon svg {
        width: 36px;
        height: 36px;
    }

    .plan-name-display {
        font-size: 1.5rem;
    }
}


/* Gallery Modal */
.gallery-modal {
    background: #1a1a1a;
    border-radius: 16px;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .gallery-modal {
    transform: scale(1);
}

.gallery-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.gallery-tab.active {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.gallery-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
    border-color: var(--primary-red);
    transform: translateY(-5px);
}

.gallery-item-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.3);
}

.gallery-item-info {
    padding: 1rem;
}

.gallery-item-prompt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-item-actions {
    display: flex;
    gap: 0.5rem;
}

.gallery-action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.gallery-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.gallery-action-btn.favorited {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.gallery-action-btn.favorited svg {
    fill: var(--primary-red);
}

.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.gallery-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.gallery-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.gallery-empty p {
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .gallery-modal {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .gallery-tabs {
        padding: 1rem;
    }

    .gallery-tab {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .gallery-content {
        padding: 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
}


/* Mobile Chat Fixes */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0.75rem;
    }

    .main-content.has-messages {
        padding-bottom: 240px !important;
    }

    .chat-container {
        padding: 0 0.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .chat-message {
        max-width: 100% !important;
    }

    .ai-response {
        max-width: 100% !important;
    }

    .user-prompt {
        font-size: 0.9375rem !important;
        padding: 1rem 1.125rem !important;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        line-height: 1.4 !important;
        white-space: pre-wrap !important;
    }

    .loading-indicator {
        padding: 0.875rem !important;
        font-size: 0.8rem !important;
    }

    .loading-text {
        font-size: 0.8rem !important;
        white-space: normal !important;
    }

    .chat-message {
        margin-bottom: 1rem;
    }

    .generated-image img {
        border-radius: 10px;
    }

    .image-actions {
        padding: 1rem;
        gap: 0.625rem;
    }

    .image-action-btn {
        width: 48px;
        height: 48px;
        border-width: 2px;
        box-shadow: 0 3px 12px rgba(255, 59, 48, 0.25), 0 0 0 1px rgba(255, 59, 48, 0.15);
    }
    
    .image-action-btn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3), 0 0 0 2px rgba(255, 59, 48, 0.25);
    }

    /* Fix input container */
    .input-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .input-container.has-messages {
        padding: 0.75rem;
    }

    .prompt-box {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    /* Fix edit mode upload area */
    .edit-upload-section {
        padding: 0;
    }

    .edit-upload-tabs {
        padding: 0.75rem;
    }

    .upload-area {
        min-height: 200px;
        margin: 0.75rem;
    }

    .upload-content {
        padding: 1.5rem 1rem;
    }

    .upload-text {
        font-size: 0.9rem;
    }

    .upload-subtext {
        font-size: 0.8rem;
    }

    /* Fix action tabs */
    .action-tabs {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }

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

    /* Fix recreate/edit modes */
    .recreate-box,
    .edit-box {
        padding: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .upload-section {
        padding: 0.75rem !important;
        max-width: 100% !important;
    }

    .link-input-wrapper {
        margin: 0.75rem !important;
        max-width: calc(100% - 1.5rem) !important;
    }

    .link-input {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .recreate-options,
    .edit-controls,
    .faceswap-controls {
        padding: 0.75rem !important;
        gap: 0.75rem !important;
        max-width: 100% !important;
    }

    .recreate-option-btn {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .recreate-prompt-input,
    .edit-prompt-input {
        min-height: 80px !important;
        font-size: 0.85rem !important;
        padding: 0.75rem !important;
        margin: 0.75rem !important;
        width: calc(100% - 1.5rem) !important;
        box-sizing: border-box !important;
    }

    .recreate-footer,
    .edit-footer {
        padding: 0.75rem !important;
        max-width: 100% !important;
    }

    .generate-btn {
        width: calc(100% - 1.5rem) !important;
        margin: 0 0.75rem !important;
    }

    /* Fix edit image container */
    .edit-image-container {
        margin: 0.75rem !important;
        max-width: calc(100% - 1.5rem) !important;
    }

    .edit-mode-tabs {
        margin: 0 0.75rem !important;
        max-width: calc(100% - 1.5rem) !important;
    }

    /* Fix upload tabs */
    .edit-upload-tabs,
    .upload-tabs {
        max-width: 100% !important;
        overflow-x: auto !important;
    }
}


/* Mode Content Transitions - All modes in input container */
.mode-content {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 100%;
    max-width: 100%;
}

.mode-content.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure all mode content stays within input container */
.input-container .mode-content {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Recreate Mode Specific Styles */
#recreateMode .upload-tabs,
#editMode .edit-upload-tabs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

#recreateMode .link-input-wrapper,
#editMode .link-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#recreateMode .upload-area,
#editMode .upload-area {
    margin-bottom: 1rem;
}

#recreateMode .recreate-options {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

#recreateMode .recreate-prompt-input,
#editMode .edit-prompt-input {
    width: 100%;
    margin-bottom: 1rem;
}

#recreateMode .recreate-footer,
#editMode .edit-footer {
    display: flex;
    justify-content: center;
}

/* Edit Mode Specific Styles */
#editMode .edit-upload-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#editMode .edit-tools-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#editMode .edit-image-container {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 300px;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
}

#editMode .edit-mode-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

#editMode .edit-controls,
#editMode .faceswap-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

/* Mobile UI - Complete Redesign for Better UX */
@media (max-width: 768px) {

    /* Prevent horizontal scroll - Global Fix */
    * {
        box-sizing: border-box;
    }

    body {
        overflow-x: hidden;
        background: #000;
        width: 100%;
        max-width: 100vw;
    }

    .main-wrapper {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .main-content {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
        padding: 0;
    }

    .chat-container {
        overflow-x: hidden;
        max-width: 100%;
        width: 100%;
        padding: 1rem 0.75rem;
        margin-bottom: 0;
        box-sizing: border-box;
    }

    /* Get Started Text */
    .get-started {
        font-size: 0.85rem;
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    /* Container - Clean Mobile Design */
    .input-container {
        padding: 1rem 0.75rem;
        border-radius: 20px;
        margin: 1rem 0.5rem;
        width: calc(100% - 1rem);
        max-width: calc(100% - 1rem);
        overflow-x: hidden;
        background: rgba(20, 20, 20, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-sizing: border-box;
    }

    .input-container::before {
        opacity: 0.6;
    }

    .input-container.has-messages {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 1rem 0.875rem 1.25rem;
        border-radius: 20px 20px 0 0;
        background: rgba(15, 15, 15, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
        box-sizing: border-box;
    }

    /* Action Tabs - Modern Mobile Design */
    .action-tabs {
        gap: 0.625rem;
        margin-bottom: 1rem;
        justify-content: center;
        padding: 0.25rem;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 14px;
    }

    .tab-btn {
        flex: 1;
        padding: 0.75rem 0.625rem;
        font-size: 0.8125rem;
        gap: 0.5rem;
        min-height: 46px;
        border-radius: 11px;
        font-weight: 600;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .tab-btn:not(.active) {
        background: transparent;
        border-color: transparent;
    }

    .tab-btn.active {
        background: var(--accent-gradient);
        box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
        transform: scale(1.02);
    }

    .tab-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Mode Content - Cleaner Layout */
    .mode-content {
        width: 100%;
        max-width: 100% !important;
        gap: 0.875rem !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .mode-content * {
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
    }

    /* All Containers - Full Width with Better Spacing */
    .link-input-wrapper,
    .upload-area,
    .recreate-options,
    .recreate-prompt-input,
    .edit-upload-section,
    .edit-tools-section,
    .prompt-footer,
    .prompt-options,
    .prompt-actions,
    .recreate-footer,
    .edit-footer {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Sub-tabs - Modern Pill Design */
    .upload-tabs,
    .edit-upload-tabs,
    .edit-mode-tabs {
        display: flex;
        gap: 0.5rem;
        max-width: 100%;
        width: 100%;
        padding: 0.25rem;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 12px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .upload-tab,
    .edit-upload-tab,
    .edit-mode-tab {
        flex: 1;
        min-width: 0;
        font-size: 0.8125rem !important;
        padding: 0.75rem 0.625rem !important;
        min-height: 44px;
        white-space: nowrap;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        box-sizing: border-box;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .upload-tab:not(.active),
    .edit-upload-tab:not(.active),
    .edit-mode-tab:not(.active) {
        background: transparent;
        border-color: transparent;
    }

    .upload-tab.active,
    .edit-upload-tab.active,
    .edit-mode-tab.active {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.12);
    }

    .upload-tab svg,
    .edit-upload-tab svg,
    .edit-mode-tab svg {
        width: 17px;
        height: 17px;
        flex-shrink: 0;
    }

    /* Recreate Options - Modern Card Style */
    .recreate-options {
        display: flex;
        gap: 0.625rem;
        flex-wrap: wrap;
    }

    .recreate-option-btn {
        flex: 1;
        min-width: calc(50% - 0.3125rem);
        font-size: 0.8125rem !important;
        padding: 0.8125rem 0.875rem !important;
        min-height: 46px;
        border-radius: 12px;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.2s ease;
    }

    .recreate-option-btn:active {
        transform: scale(0.97);
        background: rgba(255, 255, 255, 0.06);
    }

    .recreate-option-btn svg {
        width: 17px;
        height: 17px;
    }

    /* Input Fields - Modern iOS Style */
    .link-input {
        font-size: 0.9375rem !important;
        padding: 0.9375rem 0.875rem !important;
        min-height: 48px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.2s ease;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .link-input:focus {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 59, 48, 0.4);
    }

    .link-input-wrapper {
        display: flex;
        gap: 0.625rem;
        align-items: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .fetch-link-btn {
        min-width: 48px;
        max-width: 48px;
        width: 48px;
        min-height: 48px;
        flex-shrink: 0;
        border-radius: 12px;
        background: rgba(255, 59, 48, 0.12);
        border: 1px solid rgba(255, 59, 48, 0.25);
        transition: all 0.2s ease;
    }

    .fetch-link-btn:active {
        transform: scale(0.95);
        background: rgba(255, 59, 48, 0.18);
    }

    /* Textareas - Clean Modern Design */
    .recreate-prompt-input,
    .edit-prompt-input {
        font-size: 0.9375rem !important;
        padding: 0.9375rem 0.875rem !important;
        min-height: 110px !important;
        border-radius: 14px;
        line-height: 1.6;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.2s ease;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .recreate-prompt-input:focus,
    .edit-prompt-input:focus {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 59, 48, 0.4);
    }

    .prompt-input {
        font-size: 0.9375rem !important;
        min-height: 110px !important;
        padding: 0.9375rem 0.875rem !important;
        border-radius: 14px;
        line-height: 1.6;
        background: transparent;
        border: none;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Upload Area - Modern Card Design */
    .upload-area {
        padding: 1rem 0.875rem;
        min-height: 100px;
        max-height: 130px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.03);
        border: 2px dashed rgba(255, 255, 255, 0.12);
        transition: all 0.3s ease;
    }

    .upload-area:hover,
    .upload-area:active {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 59, 48, 0.4);
        transform: scale(1);
    }
    
    /* Remove image button */
    .remove-image-btn:hover {
        background: rgba(255, 59, 48, 1) !important;
        transform: scale(1.1);
    }
    
    .remove-image-btn:active {
        transform: scale(0.95);
    }

    .upload-icon {
        width: 44px;
        height: 44px;
        opacity: 0.8;
    }

    .upload-text {
        font-size: 0.9375rem !important;
        line-height: 1.5;
        font-weight: 500;
    }

    .upload-subtext {
        font-size: 0.8125rem !important;
        line-height: 1.4;
        opacity: 0.7;
    }

    /* Edit Image Container - Optimized for Mobile */
    .edit-image-container {
        max-width: 100%;
        width: 100%;
        aspect-ratio: 16/9;
        max-height: 150px;
        border-radius: 10px;
        margin: 0 auto;
    }

    .edit-canvas,
    .mask-canvas {
        max-width: 100%;
        max-height: 150px;
        object-fit: contain;
    }

    /* Edit Mode Specific - Mobile Optimized */
    .edit-upload-section,
    .edit-tools-section {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
    }

    .edit-controls,
    .faceswap-controls {
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 10px;
        width: 100%;
    }

    /* Brush Controls */
    .brush-controls {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .brush-size-control {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .brush-size-control label {
        font-size: 0.8rem;
        font-weight: 600;
    }

    .brush-size-control input[type="range"] {
        width: 100%;
        height: 8px;
    }

    .brush-size-control span {
        font-size: 0.8rem;
        color: var(--text-primary);
    }

    .clear-mask-btn {
        width: 100%;
        min-height: 44px;
        font-size: 0.85rem;
        border-radius: 10px;
        padding: 0.7rem 1rem;
    }

    /* Prompt Footer - Modern Layout */
    .prompt-footer {
        display: flex;
        flex-direction: column;
        gap: 0.875rem;
        margin-top: 0.5rem;
    }

    .prompt-options {
        display: flex;
        justify-content: center;
        gap: 0.625rem;
        width: 100%;
    }

    .option-btn {
        flex: 1;
        padding: 0.8125rem 0.875rem;
        font-size: 0.8125rem;
        min-height: 46px;
        border-radius: 12px;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.2s ease;
    }

    .option-btn:active {
        transform: scale(0.97);
        background: rgba(255, 255, 255, 0.06);
    }

    .option-btn svg {
        width: 17px;
        height: 17px;
    }

    .prompt-actions {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
        width: 100%;
    }

    .icon-btn {
        width: 100%;
        justify-content: center;
        padding: 0.8125rem 1rem;
        min-height: 46px;
        border-radius: 12px;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.2s ease;
    }

    .icon-btn:active {
        transform: scale(0.97);
        background: rgba(255, 255, 255, 0.06);
    }

    .icon-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Generate Button - Bold & Prominent */
    .generate-btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 1rem 1.5rem;
        min-height: 52px;
        font-size: 1rem;
        font-weight: 700;
        border-radius: 14px;
        box-shadow: 0 6px 20px rgba(255, 59, 48, 0.35);
        transition: all 0.2s ease;
        box-sizing: border-box;
    }

    .generate-btn:active {
        transform: scale(0.98);
        box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
    }

    .generate-btn svg {
        width: 20px;
        height: 20px;
    }

    .recreate-footer .generate-btn,
    .edit-footer .generate-btn {
        width: 100%;
        max-width: 100%;
        min-height: 52px;
    }

    /* Persona Select Button */
    .persona-select-btn {
        width: 100%;
        min-height: 44px;
        font-size: 0.85rem;
        border-radius: 10px;
    }
}

/* Compact mode when input is fixed */
.input-container.has-messages {
    padding: 0.75rem 1rem;
}

.input-container.has-messages .action-tabs {
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.input-container.has-messages .tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}

.input-container.has-messages .mode-content {
    padding: 0;
    gap: 0.75rem;
}

.input-container.has-messages .upload-tabs,
.input-container.has-messages .edit-upload-tabs {
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.input-container.has-messages .upload-tab,
.input-container.has-messages .edit-upload-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.input-container.has-messages .link-input {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.input-container.has-messages .upload-area {
    padding: 1.5rem 1rem;
    min-height: 120px;
}

.input-container.has-messages .recreate-options {
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.input-container.has-messages .recreate-option-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

/* Make recreate mode more compact after first generation */
.input-container.has-messages #recreateMode {
    gap: 0.75rem;
}

.input-container.has-messages #recreateMode .upload-tabs {
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.input-container.has-messages #recreateMode .upload-tab {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
}

.input-container.has-messages #recreateMode .upload-tab svg {
    width: 16px;
    height: 16px;
}

.input-container.has-messages #recreateMode .link-input-wrapper {
    gap: 0.5rem;
}

.input-container.has-messages #recreateMode .link-input {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
}

.input-container.has-messages #recreateMode .fetch-link-btn {
    width: 40px;
    height: 40px;
}

.input-container.has-messages #recreateMode .upload-area {
    min-height: 100px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.input-container.has-messages #recreateMode .upload-icon {
    width: 32px;
    height: 32px;
}

.input-container.has-messages #recreateMode .upload-text {
    font-size: 0.8125rem;
}

.input-container.has-messages #recreateMode .upload-subtext {
    font-size: 0.75rem;
}

.input-container.has-messages #recreateMode .recreate-prompt-input {
    min-height: 60px;
    padding: 0.75rem;
    font-size: 0.875rem;
}

.input-container.has-messages .recreate-option-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.input-container.has-messages .recreate-prompt-input,
.input-container.has-messages .edit-prompt-input {
    min-height: 60px;
    font-size: 0.9rem;
    padding: 0.75rem;
}

.input-container.has-messages .recreate-footer,
.input-container.has-messages .edit-footer {
    margin-top: 0.75rem;
}

.input-container.has-messages .edit-image-container {
    max-height: 200px;
}

.input-container.has-messages .edit-mode-tabs {
    gap: 0.25rem;
    padding: 0.25rem;
}

.input-container.has-messages .edit-mode-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.input-container.has-messages .edit-controls,
.input-container.has-messages .faceswap-controls {
    padding: 0.75rem;
    gap: 0.75rem;
}

.input-container.has-messages .prompt-input {
    min-height: 52px;
    max-height: 120px;
    font-size: 0.9rem;
    padding: 0.875rem;
}

.input-container.has-messages .prompt-footer {
    padding: 0.5rem 0 0;
    gap: 0.5rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.input-container.has-messages .prompt-options {
    gap: 0.5rem;
}

.input-container.has-messages .option-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
}

.input-container.has-messages .prompt-actions {
    gap: 0.5rem;
    flex-direction: row;
}

.input-container.has-messages .icon-btn {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
}

.input-container.has-messages .icon-btn .enhance-text {
    display: none;
}

.input-container.has-messages .generate-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
}

/* Remove old recreate-box and edit-box styles that were separate */
.recreate-box,
.edit-box {
    display: none !important;
}


/* Additional Mobile Fixes for Edit Mode */
@media (max-width: 768px) {

    /* Ensure Edit mode fits properly */
    #editMode {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    #editMode .edit-upload-section,
    #editMode .edit-tools-section {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    #editMode .edit-upload-tabs {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    #editMode .edit-mode-tabs {
        width: 100%;
        margin-bottom: 0.75rem;
        padding: 0.5rem;
    }

    #editMode .edit-image-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    #editMode .edit-controls,
    #editMode .faceswap-controls {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    #editMode .edit-prompt-input {
        width: 100%;
        max-width: 100%;
    }

    #editMode .edit-footer {
        width: 100%;
        max-width: 100%;
        margin-top: 0.75rem;
    }

    /* Compact mode adjustments for Edit */
    .input-container.has-messages #editMode .edit-image-container {
        max-height: 120px;
    }

    .input-container.has-messages #editMode .edit-mode-tabs {
        padding: 0.25rem;
        gap: 0.25rem;
    }

    .input-container.has-messages #editMode .edit-mode-tab {
        font-size: 0.7rem !important;
        padding: 0.5rem 0.4rem !important;
    }

    .input-container.has-messages #editMode .edit-controls,
    .input-container.has-messages #editMode .faceswap-controls {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .input-container.has-messages #editMode .brush-size-control {
        gap: 0.4rem;
    }

    .input-container.has-messages #editMode .brush-size-control label,
    .input-container.has-messages #editMode .brush-size-control span {
        font-size: 0.75rem;
    }

    .input-container.has-messages #editMode .clear-mask-btn {
        min-height: 40px;
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
    }

    .input-container.has-messages #editMode .edit-prompt-input {
        min-height: 60px !important;
        font-size: 0.8rem !important;
        padding: 0.65rem !important;
    }
}

/* Recreate Mode Mobile Optimizations */
@media (max-width: 768px) {
    #recreateMode {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    #recreateMode .upload-tabs {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    #recreateMode .link-input-wrapper {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
    }

    #recreateMode .link-input-wrapper .link-input {
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
    }

    #recreateMode .link-input-wrapper .fetch-link-btn {
        flex-shrink: 0;
    }

    #recreateMode .upload-area {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #recreateMode .recreate-options {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        flex-wrap: wrap;
    }

    #recreateMode .recreate-prompt-input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #recreateMode .recreate-footer {
        width: 100%;
        max-width: 100%;
        margin-top: 0.75rem;
        box-sizing: border-box;
    }
}

/* Prompt Mode Mobile Optimizations */
@media (max-width: 768px) {
    #promptMode {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    #promptMode .prompt-input {
        width: 100%;
        max-width: 100%;
    }

    #promptMode .prompt-footer {
        width: 100%;
        max-width: 100%;
    }

    #promptMode .prompt-options {
        width: 100%;
    }

    #promptMode .prompt-actions {
        width: 100%;
    }
}


/* Edit Modal Overlay */
.edit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.edit-modal-overlay.active {
    display: flex;
}

.edit-modal-container {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.95), rgba(26, 26, 26, 0.95));
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.edit-modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.edit-modal-title svg {
    color: rgba(255, 59, 48, 0.8);
}

.edit-modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.edit-modal-close:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.4);
}

.edit-modal-content {
    padding: 1.5rem;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.edit-canvas-wrapper {
    position: relative;
    width: 100%;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

#editModalCanvas,
#editModalMaskCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#editModalCanvas {
    z-index: 1;
}

#editModalMaskCanvas {
    z-index: 2;
    pointer-events: none;
}

#editModalMaskCanvas.active {
    pointer-events: all;
}

.edit-tools-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.edit-tool-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.edit-tool-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.edit-tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 59, 48, 0.3);
}

.edit-tool-btn.active {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.2), rgba(255, 149, 0, 0.2));
    border-color: rgba(255, 59, 48, 0.5);
    color: white;
}

.edit-brush-size {
    margin-bottom: 1rem;
}

.edit-brush-size label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.edit-brush-size input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.edit-brush-size input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #FF3B30, #FF9500);
    border-radius: 50%;
    cursor: pointer;
}

.edit-clear-btn {
    width: 100%;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    color: rgba(255, 59, 48, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.edit-clear-btn:hover {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.5);
}

.edit-prompt-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#editModalPromptInput {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    color: white;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

#editModalPromptInput:focus {
    outline: none;
    border-color: rgba(255, 59, 48, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.edit-generate-btn {
    background: linear-gradient(135deg, #FF3B30, #FF9500);
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3);
}

.edit-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 59, 48, 0.5);
}

.edit-generate-btn:active {
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .edit-modal-container {
        max-height: 95vh;
        border-radius: 16px;
    }

    .edit-modal-header {
        padding: 1rem;
    }

    .edit-modal-title {
        font-size: 1.25rem;
    }

    .edit-modal-content {
        padding: 1rem;
    }

    .edit-canvas-wrapper {
        max-height: 250px;
    }

    .edit-tool-group {
        flex-direction: column;
    }
}


/* Simple & Clean Loading Animation */
.loading-thumbnail {
    position: relative;
    width: 100%;
    max-width: 650px;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.95), rgba(26, 26, 26, 0.95));
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.25rem;
}

.loading-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 59, 48, 0.08) 50%,
        transparent 100%
    );
    animation: shimmerSlide 2s ease-in-out infinite;
}

@keyframes shimmerSlide {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.loading-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-percentage {
    font-size: 3.5rem;
    font-weight: 700;
    color: #FF9500;
    letter-spacing: -0.02em;
    line-height: 1;
}

.loading-icon {
    color: rgba(255, 149, 0, 0.8);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.loading-thumbnail .loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

@media (min-width: 768px) {
    .loading-thumbnail {
        max-width: 750px;
        border-radius: 20px;
    }
    
    .loading-percentage {
        font-size: 4.5rem;
    }
    
    .loading-icon {
        width: 56px;
        height: 56px;
    }
    
    .loading-thumbnail .loading-text {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .loading-thumbnail {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .loading-percentage {
        font-size: 2.5rem;
    }
    
    .loading-icon {
        width: 40px;
        height: 40px;
    }
    
    .loading-thumbnail .loading-text {
        font-size: 0.875rem;
    }
    
    .loading-content {
        gap: 0.75rem;
    }
}


/* Persona Grid */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem;
    padding: 0;
    width: 100%;
}

.persona-card {
    position: relative;
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 59, 48, 0.08), transparent 70%),
        linear-gradient(145deg, rgba(35, 30, 30, 1), rgba(28, 25, 25, 1));
    border: 1.5px solid rgba(255, 100, 80, 0.2);
    border-radius: 18px;
    padding: 2.5rem 1.5rem 1.75rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    min-height: 200px;
    overflow: hidden;
}

.persona-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
    pointer-events: none;
}

.persona-card:hover {
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 59, 48, 0.12), transparent 70%),
        linear-gradient(145deg, rgba(40, 32, 32, 1), rgba(32, 28, 28, 1));
    border-color: rgba(255, 80, 60, 0.35);
    transform: translateY(-4px);
    box-shadow: 
        0 12px 32px rgba(255, 59, 48, 0.2),
        0 0 40px rgba(255, 149, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.persona-card.selected {
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 59, 48, 0.15), transparent 70%),
        linear-gradient(145deg, rgba(45, 32, 30, 1), rgba(38, 28, 26, 1));
    border: 2px solid rgba(255, 80, 50, 0.6);
    position: relative;
    box-shadow: 
        0 0 0 1px rgba(255, 80, 50, 0.4),
        0 12px 40px rgba(255, 59, 48, 0.3),
        0 0 50px rgba(255, 149, 0, 0.15);
    transform: translateY(-4px);
}



.persona-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 120, 100, 0.25);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.08);
    transition: all 0.4s;
}

.persona-card:hover .persona-avatar {
    border-color: rgba(255, 80, 60, 0.4);
    transform: scale(1.05);
    box-shadow: 
        0 6px 20px rgba(255, 59, 48, 0.25),
        0 0 30px rgba(255, 149, 0, 0.12);
}

.persona-card.selected .persona-avatar {
    border: 3px solid rgba(255, 149, 0, 0.7);
    box-shadow: 
        0 0 30px rgba(255, 149, 0, 0.3),
        0 6px 24px rgba(255, 59, 48, 0.25);
}

.persona-name {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 59, 48, 0.06);
    border-radius: 10px;
    width: 100%;
}

.persona-card:hover .persona-name {
    color: white;
    background: rgba(255, 59, 48, 0.1);
}

.persona-card.selected .persona-name {
    background: rgba(255, 100, 60, 0.15);
    color: rgba(255, 200, 150, 1);
    font-weight: 700;
}

.persona-delete-btn {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.95), rgba(255, 59, 48, 1));
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    color: white;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.5);
    z-index: 10;
}

.persona-card:hover .persona-delete-btn {
    opacity: 1;
}

.persona-delete-btn:hover {
    background: rgba(255, 59, 48, 1);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .persona-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .persona-avatar {
        width: 60px;
        height: 60px;
    }
    
    .persona-name {
        font-size: 0.8125rem;
    }
}


/* Persona Selected State - Orange Border on Personas Button */
.option-btn.persona-selected,
.recreate-option-btn.persona-selected {
    border: 2px solid transparent;
    background: linear-gradient(rgba(10, 10, 10, 0.6), rgba(10, 10, 10, 0.6)) padding-box,
                linear-gradient(135deg, #FF3B30, #FF9500) border-box;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.3);
    animation: personaGlow 2s ease-in-out infinite;
}

.option-btn.persona-selected:hover,
.recreate-option-btn.persona-selected:hover {
    background: linear-gradient(rgba(20, 20, 20, 0.8), rgba(20, 20, 20, 0.8)) padding-box,
                linear-gradient(135deg, #FF3B30, #FF9500) border-box;
    box-shadow: 0 0 30px rgba(255, 59, 48, 0.5);
}

@keyframes personaGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 59, 48, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 149, 0, 0.5);
    }
}
