/* 🎨 Imagen Editor - Brand-Consistent Styles */

:root {
    --primary: #00fff6;
    --primary-dark: #00d4cc;
    --secondary: #ff007c;
    --accent-purple: #764ba2;
    --accent-blue: #667eea;
    --success: #00ff88;
    --error: #ff007c;
    --dark: #0a0e27;
    --darker: #050812;
    --darkest: #020408;
}

/* Style Transfer Gallery */
.style-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.style-btn {
    background: linear-gradient(135deg, rgba(0, 255, 246, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(0, 255, 246, 0.3);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.style-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 246, 0.2), rgba(118, 75, 162, 0.2));
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 246, 0.3);
}

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

.style-btn.active {
    background: linear-gradient(135deg, rgba(0, 255, 246, 0.3), rgba(118, 75, 162, 0.3));
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 255, 246, 0.5);
}

.style-icon {
    font-size: 1.5rem;
}

.style-name {
    font-size: 0.7rem;
    text-align: center;
}

@media (max-width: 768px) {
    .style-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Prompt Enhancer Toggle */
.enhance-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s;
}

.enhance-toggle:hover {
    color: var(--primary);
}

.enhance-toggle input[type="checkbox"] {
    appearance: none;
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 246, 0.3);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.enhance-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    top: 1px;
    left: 1px;
    transition: all 0.3s;
}

.enhance-toggle input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    border-color: var(--primary);
}

.enhance-toggle input[type="checkbox"]:checked::before {
    background: white;
    left: 21px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--darkest);
    color: white;
    min-height: 100vh;
}

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

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s ease;
}

.header h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.6);
}

.editor-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 246, 0.1);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.mode-btn {
    padding: 0.875rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--dark);
    box-shadow: 0 4px 15px rgba(0, 255, 246, 0.3);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-textarea {
    resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 255, 246, 0.1);
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.btn {
    font-weight: 700;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--dark);
    box-shadow: 0 4px 15px rgba(0, 255, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

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

.btn-lg {
    padding: 1.25rem 3rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.w-full {
    width: 100%;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(0, 255, 246, 0.05);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.canvas-container {
    min-height: 600px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: rgba(255, 255, 255, 0.6);
}

.loading-state {
    text-align: center;
    padding: 3rem;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.result-image {
    max-width: 100%;
    max-height: 600px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.history-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.history-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.history-item:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.api-key-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.text-primary {
    color: var(--primary);
    text-decoration: none;
}

.text-primary:hover {
    text-decoration: underline;
}

#toastContainer {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 246, 0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
