:root {
    --primary-color: #4e5af2;
    --primary-hover: #3a46e1;
    --secondary-color: #6c757d;
    --light-bg: #f8f9fa;
    --dark-text: #343a40;
    --light-text: #f8f9fa;
    --danger: #dc3545;
    --success: #198754;
    --warning: #ffc107;
    --info: #0dcaf0;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* Card and container colors */
    --card-bg: white;
    --container-bg: #f0f2f5;
    --tab-bg: var(--light-bg);
    --active-tab-bg: white;
    --suggestion-bg: var(--light-bg);
    --history-item-bg: var(--light-bg);
    --edit-example-bg: var(--light-bg);
    --info-bg: var(--light-bg);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Add smooth transition for theme changes */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body, .card, input, textarea, select, button, .tab, .suggestion, 
.history-item, .edit-example, .image-info, .pro-tips, 
.upload-guidance, .edit-guidance, .step-number, .step-title {
    transition: all 0.3s ease;
}

body {
    background-color: var(--container-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #4e5af2, #9c55f5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--dark-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

h3 i {
    color: var(--primary-color);
}

.subtitle {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    background: var(--tab-bg);
    overflow: hidden;
}

.tab {
    flex: 1;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab.active {
    border-bottom: 3px solid var(--primary-color);
    background-color: var(--active-tab-bg);
}

.tab:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.03);
}

.tab-content {
    display: none;
    padding: 25px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Step Indicators */
.steps-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    position: relative;
}

.steps-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #dee2e6;
    z-index: 1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    background-color: #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 8px;
    transition: var(--transition);
}

.step-title {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
    transition: var(--transition);
}

.step.active .step-number {
    background-color: var(--primary-color);
    color: white;
}

.step.active .step-title {
    color: var(--primary-color);
    font-weight: 600;
}

.step.completed .step-number {
    background-color: var(--success);
    color: white;
}

/* Prompt Builder */
.prompt-builder {
    background-color: rgba(78, 90, 242, 0.05);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.builder-instruction {
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.builder-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.builder-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.builder-section label {
    font-weight: 500;
    color: var(--dark-text);
}

.builder-section select {
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    background-color: white;
    cursor: pointer;
}

.builder-section select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 90, 242, 0.1);
}

/* Prompt Inspiration */
.prompt-inspiration {
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: #fff;
    color: var(--dark-text);
    font-size: 1rem;
    transition: var(--transition);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 90, 242, 0.2);
}

button {
    padding: 14px 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

button:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    background-color: var(--light-bg);
    transition: var(--transition);
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--primary-color);
    background-color: rgba(78, 90, 242, 0.03);
}

.file-upload i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.file-upload input {
    display: none;
}

.image-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.image-container {
    position: relative;
    max-width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.result-img {
    max-width: 100%;
    display: block;
}

.edit-area {
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background-color: var(--light-bg);
    color: var(--dark-text);
    transition: var(--transition);
}

.action-btn:hover {
    background-color: var(--secondary-color);
    color: white;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(78, 90, 242, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-text {
    margin-bottom: 5px;
    font-weight: 500;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.5s ease;
    animation: progress-animation 10s ease-in-out forwards;
}

@keyframes progress-animation {
    0% { width: 5%; }
    50% { width: 65%; }
    75% { width: 85%; }
    100% { width: 95%; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
    border-left: 4px solid var(--danger);
}

.info-text {
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
}

/* Pro Tips */
.pro-tips {
    background-color: var(--info-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.pro-tips ul {
    list-style-type: none;
    padding-left: 10px;
}

.pro-tips li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
}

.pro-tips li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Upload Guidance */
.upload-guidance {
    background-color: var(--info-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.upload-guidance ul {
    list-style-type: none;
    padding-left: 10px;
}

.upload-guidance li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
}

.upload-guidance li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Edit Guidance */
.edit-guidance {
    width: 100%;
    margin-bottom: 20px;
}

.edit-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.edit-example {
    background-color: var(--edit-example-bg);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.edit-example:hover {
    background-color: rgba(78, 90, 242, 0.2);
}

/* Result header */
.result-header {
    width: 100%;
    text-align: center;
    margin-bottom: 15px;
}

.result-header h3 {
    justify-content: center;
}

.result-header p {
    color: var(--secondary-color);
}

/* Edit History */
.edit-history {
    width: 100%;
    margin-top: 20px;
    border-top: 1px solid #dee2e6;
    padding-top: 20px;
}

.history-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    background-color: var(--history-item-bg);
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.history-item:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.history-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.history-item-prompt {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.history-item-timestamp {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.history-item-action {
    cursor: pointer;
    color: var(--primary-color);
}

/* Responsive styles */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .builder-sections {
        grid-template-columns: 1fr;
    }

    .step-title {
        font-size: 0.8rem;
    }
}

.hidden {
    display: none;
}

.prompt-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.suggestion {
    display: inline-block;
    background-color: var(--suggestion-bg);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    margin: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.suggestion:hover {
    background-color: rgba(78, 90, 242, 0.2);
}

.image-info {
    padding: 8px 12px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--info-bg);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.copy-text {
    cursor: pointer;
    color: var(--primary-color);
}

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.version {
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.7;
}

/* Dark Mode Theme */
:root {
    --primary-color: #4e5af2;
    --primary-hover: #3a46e1;
    --secondary-color: #6c757d;
    --light-bg: #f8f9fa;
    --dark-text: #343a40;
    --light-text: #f8f9fa;
    --danger: #dc3545;
    --success: #198754;
    --warning: #ffc107;
    --info: #0dcaf0;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* Card and container colors */
    --card-bg: white;
    --container-bg: #f0f2f5;
    --tab-bg: var(--light-bg);
    --active-tab-bg: white;
    --suggestion-bg: var(--light-bg);
    --history-item-bg: var(--light-bg);
    --edit-example-bg: var(--light-bg);
    --info-bg: var(--light-bg);
}

.dark-mode {
    --primary-color: #5d6bf2;
    --primary-hover: #4a56e8;
    --secondary-color: #9ca3af;
    --light-bg: #2a2d3a;
    --dark-text: #e2e8f0;
    --light-text: #f8f9fa;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
    
    /* Card and container colors */
    --card-bg: #1e2130;
    --container-bg: #13151e;
    --tab-bg: #22253a;
    --active-tab-bg: #1e2130;
    --suggestion-bg: #22253a;
    --history-item-bg: #22253a;
    --edit-example-bg: #22253a;
    --info-bg: #22253a;
}

.dark-mode body {
    background-color: var(--container-bg);
    color: var(--dark-text);
}

.dark-mode .card {
    background: var(--card-bg);
}

.dark-mode .tabs {
    background: var(--tab-bg);
}

.dark-mode .tab.active {
    background-color: var(--active-tab-bg);
}

.dark-mode .suggestion,
.dark-mode .history-item,
.dark-mode .edit-example,
.dark-mode .image-info,
.dark-mode .pro-tips,
.dark-mode .upload-guidance,
.dark-mode .edit-guidance {
    background-color: var(--suggestion-bg);
}

.dark-mode h1 {
    background: linear-gradient(90deg, #5d6bf2, #a566f6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.dark-mode .subtitle,
.dark-mode .step-title,
.dark-mode footer,
.dark-mode .version {
    color: var(--secondary-color);
}

.dark-mode input, 
.dark-mode textarea, 
.dark-mode select {
    background-color: #252836;
    color: var(--light-text);
    border: 1px solid #32364a;
}

.dark-mode input:focus, 
.dark-mode textarea:focus, 
.dark-mode select:focus {
    border-color: var(--primary-color);
    background-color: #2a2d3a;
}

.dark-mode button {
    background-color: var(--primary-color);
}

.dark-mode .action-btn {
    background-color: var(--light-bg);
    color: var(--light-text);
}

/* Theme Toggle */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: transparent;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    color: #555;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-size: 18px;
    padding: 0;
}

.dark-mode #theme-toggle {
    color: #ddd;
}

#theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.toggle-icon {
    transition: all 0.3s ease;
}

.dark-mode .pro-tips li::before,
.dark-mode .upload-guidance li::before {
    color: var(--primary-color);
}

.dark-mode .step.completed .step-number {
    background-color: var(--primary-color);
    color: var(--light-text);
}

.dark-mode .action-buttons {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .tab:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .suggestion:hover,
.dark-mode .edit-example:hover,
.dark-mode .history-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.dark-mode .spinner {
    border-top-color: var(--primary-color);
}

.history-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 5px;
}

.history-item-action {
    font-size: 0.85rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    padding: 2px 8px;
    border-radius: 4px;
}

.history-item-action:hover {
    background-color: rgba(78, 90, 242, 0.1);
}

.restore-action {
    display: flex;
    align-items: center;
}

.remove-action {
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-action:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.clear-all-history {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    border: none;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 15px;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-all-history:hover {
    background-color: rgba(220, 53, 69, 0.2);
}

.dark-mode .clear-all-history {
    background-color: rgba(220, 53, 69, 0.2);
}

.dark-mode .clear-all-history:hover {
    background-color: rgba(220, 53, 69, 0.3);
}

.dark-mode .remove-action:hover {
    background-color: rgba(220, 53, 69, 0.2);
}

.dark-mode .history-item-action:hover {
    background-color: rgba(78, 90, 242, 0.2);
}

/* Style for the Add buttons in prompt builder */
.add-prompt-part {
    padding: 5px 10px;
    font-size: 0.85rem;
    background-color: var(--primary-color);
    color: var(--light-text);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 5px; /* Add space above the button */
    align-self: flex-start; /* Align button to the start of the flex container */
}

.add-prompt-part i {
    margin-right: 4px;
}

.add-prompt-part:hover {
    background-color: var(--primary-hover);
    opacity: 0.9;
}

/* Negative Prompt Group Styling */
.negative-prompt-group {
    margin-top: 15px; /* Add space above the negative prompt section */
}

.negative-prompt-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.negative-prompt-group textarea {
    min-height: 60px; /* Make it shorter than the main prompt */
}

/* Dark mode styles for new elements */
.dark-mode .add-prompt-part {
    background-color: var(--primary-color); /* Keep primary for buttons */
    color: var(--light-text);
}

.dark-mode .add-prompt-part:hover {
    background-color: var(--primary-hover);
}

.dark-mode .negative-prompt-group label {
    color: var(--light-text);
}

/* Ensure builder sections have enough space */
.builder-section {
    display: flex;
    flex-direction: column;
    gap: 5px; 
    /* Ensure buttons don't stretch */
    /* align-items: flex-start; /* Already handled by align-self on button */
} 