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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

main {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#url-tab {
    display: flex;
    gap: 10px;
}

#image-url {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#image-url:focus {
    outline: none;
    border-color: #667eea;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 2px dashed #d0d0d0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.file-label:hover {
    border-color: #667eea;
    background: #f5f5ff;
}

.file-label.drag-over {
    border-color: #667eea;
    background: #f0f0ff;
}

.file-label svg {
    stroke: #667eea;
    margin-bottom: 10px;
}

.file-label span {
    color: #666;
}

.file-hint {
    font-size: 0.9rem;
    margin-top: 5px;
    color: #999;
}

.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.image-preview {
    aspect-ratio: 4/3;
    background: #f8f8f8;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.placeholder {
    text-align: center;
    color: #999;
}

.placeholder svg {
    stroke: #d0d0d0;
    margin-bottom: 10px;
}

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

.prompt-section label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-size: 0.9rem;
}

#custom-prompt {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

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

.setting-item label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-size: 0.9rem;
}

.setting-item input,
.setting-item select {
    width: 100%;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.primary-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.generate-btn {
    position: relative;
}

.generate-btn.loading .btn-text {
    opacity: 0;
}

.generate-btn.loading .spinner {
    display: block;
}

.spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.output-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.output-section h2 {
    color: #333;
    margin-bottom: 15px;
}

.output-container {
    background: #f8f8f8;
    border-radius: 10px;
    padding: 20px;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    line-height: 1.6;
}

.output-placeholder {
    color: #999;
}

.typing-indicator {
    color: #667eea;
    font-style: italic;
}

.typing-indicator::after {
    content: '...';
    animation: dots 1.5s infinite;
}

.secondary-btn {
    padding: 10px 20px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: #667eea;
    color: white;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 2000;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #4caf50;
}

.notification.error {
    background: #f44336;
}

.notification.info {
    background: #2196f3;
}

.error {
    color: #f44336;
    padding: 10px;
    background: #ffebee;
    border-radius: 5px;
}

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

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .preview-section {
        grid-template-columns: 1fr;
    }
    
    .settings {
        grid-template-columns: 1fr;
    }
    
    main {
        padding: 20px;
    }
}