:root {
    --black: #0d0d0d;
    --yellow: #ffd700;
    --dark-gray: #1a1a1a;
    --medium-gray: #2c2c2c;
    --light-gray: #444;
    --text-color: #f0f0f0;
    --text-muted: #aaa;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--black);
    color: var(--text-color);
    padding: 2rem;
    font-size: 16px;
}

#app-container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--dark-gray);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--light-gray);
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}

.logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--yellow);
    position: absolute;
    left: 0;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--yellow);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

main {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 300px;
}

#left-column { gap: 1.5rem; }
#right-column { gap: 1.5rem; }

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

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

textarea, select {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--medium-gray);
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: all var(--transition-speed) ease;
}

textarea:focus, select:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffd700' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.7em top 50%;
    background-repeat: no-repeat;
    background-size: 1.5em;
    padding-right: 2.5em;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: var(--light-gray);
    border-radius: 5px;
    outline: none;
    padding: 0;
    margin-top: 0.5rem;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--yellow);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--dark-gray);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--yellow);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--dark-gray);
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-transform: uppercase;
}

.btn-primary {
    background-color: var(--yellow);
    color: var(--black);
    flex-grow: 1;
}
.btn-primary span {
    color: var(--black);
}
.btn-primary:hover {
    background-color: #ffed4a;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.2);
}
.btn-primary:disabled {
    background-color: var(--light-gray);
    color: var(--text-muted);
    cursor: not-allowed;
}
.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}


.btn-secondary {
    background-color: transparent;
    color: var(--yellow);
    border: 2px solid var(--yellow);
}
.btn-secondary:hover:not(:disabled) {
    background-color: var(--yellow);
    color: var(--black);
}

.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-tertiary {
    background-color: var(--medium-gray);
    color: var(--text-muted);
}
.btn-tertiary:hover {
    background-color: var(--light-gray);
    color: var(--text-color);
}

#reset-btn {
    background-color: #cc0000;
    color: white;
}
#reset-btn:hover {
    background-color: #e60000;
}

.output-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.output-wrapper {
    position: relative;
    display: flex;
    flex: 1;
}

#output-prompt {
    height: 100%;
    min-height: 250px;
    resize: none;
    padding-right: 4rem;
}

#negative-prompt {
    height: 80px;
    min-height: 80px;
    resize: none;
    padding-right: 4rem;
    font-size: 0.85rem;
}

.btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--light-gray);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
}

.btn-copy:hover {
    background-color: var(--yellow);
    color: var(--black);
}

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

/* Image Upload Preview */
.image-upload-container {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 0.5rem;
}

.preview-box {
    width: 100%;
    height: 120px;
    border: 2px dashed var(--light-gray);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: var(--medium-gray);
    transition: border-color 0.3s ease;
}

.preview-box.clickable-zone {
    cursor: pointer;
}

.preview-box.clickable-zone:hover {
    border-color: var(--yellow);
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.preview-box .placeholder-text {
    font-size: 0.8rem;
    text-align: center;
}

.btn-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
}

@media (max-width: 1200px) {
    main {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    #app-container {
        padding: 1rem;
    }
    header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    header h1 {
        font-size: 1.5rem;
    }
    .control-grid {
        grid-template-columns: 1fr;
    }
    .image-upload-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .preview-box {
        width: 100%;
        height: 150px;
    }
}