:root {
    --primary-color: #6c5ce7;
    --primary-dark: #5649c0;
    --secondary-color: #a29bfe;
    --text-color: #2d3436;
    --light-text: #636e72;
    --bg-color: #f9f9f9;
    --card-color: #ffffff;
    --border-radius: 12px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--light-text);
    font-size: 1.1rem;
}

.generator-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
}

.input-section, .output-section {
    width: 100%;
}

.prompt-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.prompt-box textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 1px solid #dfe6e9;
    border-radius: var(--border-radius);
    resize: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.prompt-box textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--light-text);
    font-weight: 500;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #dfe6e9;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: #f5f3ff;
    transform: translateY(-2px);
}

.image-placeholder, .image-results, .loading {
    width: 100%;
    min-height: 300px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #f8f9fa;
    border: 2px dashed #dfe6e9;
    transition: all 0.3s ease;
}

.image-placeholder i {
    font-size: 3rem;
    color: var(--light-text);
    margin-bottom: 1rem;
}

.image-placeholder p {
    color: var(--light-text);
    font-size: 1.1rem;
}

.image-results {
    padding: 1rem;
    border: none;
    background-color: transparent;
    min-height: auto;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    width: 100%;
}

.generated-image-container {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
}

.generated-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.generated-image:hover {
    transform: scale(1.03);
}

.image-info {
    padding: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.8rem;
    text-align: center;
}

.download-single-btn {
    margin-top: auto;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    width: 100%;
}

.image-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.loading {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--secondary-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--light-text);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .image-actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
    }
}