:root {
    --primary-blue: #4285f4;
    --primary-purple: #9c27b0;
    --secondary-blue: #1a73e8;
    --secondary-purple: #673ab7;
    --success-green: #34a853;
    --warning-orange: #fbbc04;
    --error-red: #ea4335;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --surface: #ffffff;
    --surface-variant: #f8f9fa;
    --outline: #dadce0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.container__image {
    width: 100%;
    height: 100%;
    min-height: 5rem;
}

.container__text {
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.title {
    font-size: 3rem;
    font-weight: 300;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.main-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.input-section {
    margin-bottom: 2rem;
}

.input-label {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.main-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.125rem;
    border: 2px solid var(--outline);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
}

.main-input:focus {
    border-color: var(--primary-blue);
    box-shadow:
        0 0 0 4px rgba(66, 133, 244, 0.1),
        0 2px 8px rgba(66, 133, 244, 0.15);
    transform: translateY(-1px);
}

.main-input::placeholder {
    color: var(--text-secondary);
}

.button-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.generate-btn {
    flex: 1;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: white;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 16px rgba(66, 133, 244, 0.3);
    font-family: inherit;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(66, 133, 244, 0.4);
}

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

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.reset-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface-variant);
    border: 2px solid var(--outline);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.reset-btn:hover {
    background: var(--outline);
    transform: translateY(-1px);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

.alert-error {
    background: rgba(234, 67, 53, 0.1);
    border: 1px solid rgba(234, 67, 53, 0.2);
    color: var(--error-red);
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.loading-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.5s ease-out;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--outline);
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 1rem;
    color: var(--text-secondary);
}

.image-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.5s ease-out;
}

.image-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.image-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.image-prompt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: var(--surface-variant);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
}

.image-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.image-container__item {
    display: grid;
    grid-template-columns: 50% 50%;
}

.generated-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.generated-image:hover {
    transform: scale(1.02);
}

.image-actions {
    display: grid;
    justify-content: center;
    gap: 1rem;
}

.download-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-blue);
    background: rgba(66, 133, 244, 0.1);
    border: 2px solid rgba(66, 133, 244, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    margin: 0 auto;
    gap: 0.5rem;
    font-family: inherit;
}

.download-btn:hover {
    background: rgba(66, 133, 244, 0.15);
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container__text {
        font-size: 0.8rem;
        padding: 0.8rem;
    }

    .container {
        padding: 1rem;
    }

    .title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.125rem;
    }

    .image-card {
        padding: 1.5rem;
    }

    .main-card {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .button-container {
        flex-direction: column;
    }

    .generate-btn {
        flex: none;
    }

    .loading-card {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }

    .container__image {
        height: inherit;
    }

    .image-card {
        padding: 1rem;
    }

    .main-card {
        margin-bottom: 1rem;
    }

    .main-input {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }

    .generate-btn {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes sparkleAnimation {
    0% {
        opacity: 1;
        transform: scale(0) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }

    100% {
        opacity: 0;
        transform: scale(0) rotate(360deg);
    }
}