:root {
    --primary-color: #ff3366;
    --primary-hover: #e0285a;
    --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #333333;
    --text-muted: #666666;
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient: linear-gradient(135deg, #1e1e24 0%, #15151a 100%);
        --card-bg: rgba(30, 30, 36, 0.7);
        --text-main: #f0f0f0;
        --text-muted: #aaaaaa;
        --glass-border: rgba(255, 255, 255, 0.1);
        --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Background animated circles for premium look */
.background-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
}

.background-overlay::before, .background-overlay::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.background-overlay::before {
    width: 600px;
    height: 600px;
    background: rgba(255, 51, 102, 0.15);
    top: -200px;
    left: -200px;
}

.background-overlay::after {
    width: 500px;
    height: 500px;
    background: rgba(51, 102, 255, 0.15);
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 100px); }
}

.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1;
}

header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

header h1 span {
    color: var(--primary-color);
}

header p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    animation: fadeInUp 0.8s ease-out;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 51, 102, 0.1);
}

.file-drop-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    margin-bottom: 1.5rem;
}

.file-drop-area:hover, .file-drop-area.dragover {
    border-color: var(--primary-color);
    background: rgba(255, 51, 102, 0.05);
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    pointer-events: none;
}

.upload-icon {
    color: var(--primary-color);
    opacity: 0.8;
}

.sub-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hidden-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.file-badge {
    background: rgba(255, 51, 102, 0.1);
    color: var(--primary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: scaleIn 0.3s ease;
}

.remove-file {
    cursor: pointer;
    font-weight: bold;
    color: inherit;
    transition: transform 0.2s;
}

.remove-file:hover {
    transform: scale(1.2);
}

.primary-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 102, 0.4);
}

.primary-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.5;
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Results Section */
.results-section {
    animation: fadeInUp 0.8s ease-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.secondary-btn {
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: white;
}

.generated-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.image-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.image-card:hover {
    transform: translateY(-5px);
}

.image-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.card-actions {
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.card-actions button {
    width: 100%;
    padding: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.card-actions button:hover {
    background: var(--primary-hover);
}

.hidden {
    display: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
