:root {
    --primary-color: #6e45e2;
    --secondary-color: #88d3ce;
    --accent-color: #ff7e5f;
    --text-color: #333;
    --text-light: #f8f9fa;
    --background-color: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.8);
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --glass-blur: 10px;
    --transition: all 0.3s ease;
}

:root.dark-mode {
    --primary-color: #8a63f2;
    --secondary-color: #63f2c8;
    --accent-color: #ff9e7f;
    --text-color: #f8f9fa;
    --text-light: #333;
    --background-color: #121212;
    --card-bg: rgba(30, 30, 30, 0.9);
    --border-color: rgba(255, 255, 255, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.4);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(138, 99, 242, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(99, 242, 200, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(255, 158, 127, 0.1) 0%, transparent 30%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    transition: var(--transition);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(110, 69, 226, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(136, 211, 206, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(255, 126, 95, 0.1) 0%, transparent 30%);
    background-attachment: fixed;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.header h1 {
    margin: 0;
    font-size: 1.8rem;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 0 10px;
}

.header h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.header h1 span {
    font-weight: 300;
    font-size: 1rem;
    display: block;
    margin-top: 5px;
    letter-spacing: 1px;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.language-switch button {
    padding: 5px 10px;
    border: none;
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.language-switch button.active {
    background: var(--primary-color);
    color: white;
}

.theme-toggle {
    background: var(--card-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 16px;
    box-shadow: 0 4px 30px var(--shadow-color);
    border: 1px solid var(--border-color);
}

:root.dark-mode .glass {
    box-shadow: 0 4px 20px var(--shadow-color);
}

.generator-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 25px;
    margin-bottom: 30px;
}

@media (min-width: 992px) {
    .generator-container {
        flex-direction: row;
    }
    
    .input-section {
        flex: 0 0 40%;
    }
    
    .output-section {
        flex: 1;
    }
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.prompt-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transition: var(--transition);
}

:root.dark-mode textarea,
:root.dark-mode select,
:root.dark-mode input[type="number"],
:root.dark-mode input[type="text"] {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(110, 69, 226, 0.2);
}

.prompt-controls {
    display: flex;
    gap: 10px;
}

.negative-prompt {
    margin-top: -10px;
}

.negative-prompt textarea {
    min-height: 80px;
}

.advanced-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.accordion {
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.accordion-header {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(110, 69, 226, 0.1);
    transition: var(--transition);
}

.accordion-header:hover {
    background: rgba(110, 69, 226, 0.2);
}

.accordion-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.accordion-header i {
    transition: var(--transition);
}

.accordion-header.active i {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
}

.accordion-content.open {
    padding: 15px;
    max-height: 1000px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.control-group.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 500;
}

select, input[type="number"], input[type="text"] {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transition: var(--transition);
}

select:focus, input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(110, 69, 226, 0.2);
}

input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary-color);
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    accent-color: var(--primary-color);
    outline: none;
}

.dimensions-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
}

.generate-btn {
    font-size: 1.1rem;
    padding: 15px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    margin-top: 10px;
}

.small-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    background: rgba(110, 69, 226, 0.1);
    color: var(--text-color);
}

.small-btn:hover {
    background: rgba(110, 69, 226, 0.3);
    transform: none;
}

.action-btn {
    background: rgba(110, 69, 226, 0.1);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.action-btn:hover {
    background: rgba(110, 69, 226, 0.3);
}

.output-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-placeholder {
    width: 100%;
    min-height: 400px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
}

.image-placeholder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.image-placeholder p {
    color: var(--text-color);
    opacity: 0.7;
    text-align: center;
    padding: 20px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    z-index: 10;
}

.cyber-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid transparent;
    border-top: 4px solid var(--primary-color);
    border-bottom: 4px solid var(--accent-color);
    border-radius: 50%;
    position: relative;
    animation: spin 1s linear infinite;
}

.cyber-spinner::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 4px solid transparent;
    border-left: 4px solid var(--secondary-color);
    border-right: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spinReverse 1.5s linear infinite;
}

.loading-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--accent-color);
    letter-spacing: 2px;
    animation: pulse 1.5s infinite alternate;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinReverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes pulse {
    0% { opacity: 0.6; text-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--accent-color); }
    100% { opacity: 1; text-shadow: 0 0 15px var(--primary-color), 0 0 30px var(--accent-color); }
}

.output-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.social-share {
    display: flex;
    gap: 8px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.facebook { background: #3b5998; }
.twitter { background: #1da1f2; }
.whatsapp { background: #25d366; }
.tiktok { background: #000000; }

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.grid-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1/1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.grid-item:hover img {
    transform: scale(1.05);
}

.grid-item .grid-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    display: flex;
    justify-content: space-around;
    opacity: 0;
    transition: var(--transition);
}

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

.history-section {
    margin-top: 20px;
}

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

.history-header h3 {
    margin: 0;
    font-size: 1rem;
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
}

:root.dark-mode #history-list {
    background: rgba(0, 0, 0, 0.3);
}

#history-list li {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

#history-list li:last-child {
    border-bottom: none;
}

#history-list li:hover {
    background: rgba(110, 69, 226, 0.1);
    border-radius: 4px;
}

:root.dark-mode #history-list li:hover {
    background: rgba(138, 99, 242, 0.2);
}

.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    border-top: 1px solid var(--border-color);
}

.footer p {
    margin: 5px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .dimensions-container {
        grid-template-columns: 1fr;
    }
    
    .output-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .social-share {
        justify-content: center;
    }
}

/* Cyberpunk elements */
.cyber-border {
    position: relative;
}

.cyber-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-image: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--secondary-color)) 1;
    border-radius: 10px;
    z-index: -1;
    animation: borderGlow 2s linear infinite;
}

@keyframes borderGlow {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}