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

:root {
    --bg-primary: #1a1625;
    --bg-secondary: #2a2438;
    --bg-card: rgba(42, 36, 56, 0.6);
    --text-primary: #f5f3f7;
    --text-secondary: #a89bb8;
    --accent: #a855f7;
    --accent-hover: #9333ea;
    --border: rgba(255, 255, 255, 0.12);
    --shadow: rgba(0, 0, 0, 0.3);
}

body.light-theme {
    --bg-primary: #f5f3f7;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-primary: #1a1625;
    --text-secondary: #6b5f7a;
    --border: rgba(0, 0, 0, 0.12);
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
.background-animated {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, var(--bg-primary) 50%, rgba(59, 130, 246, 0.1) 100%);
    z-index: -2;
}

.background-animated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px var(--shadow);
    animation: fadeInUp 0.6s ease-out;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: white;
}

.login-card h1 {
    font-size: 32px;
    margin-bottom: 12px;
    font-weight: 700;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 16px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-circle-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main Content */
.main-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
    box-sizing: border-box;
}

/* Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px var(--shadow);
}

.generator-card {
    margin-bottom: 32px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-text {
    flex: 1;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.input-text:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.select-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
}

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

.btn-primary.loading svg {
    animation: spin 1s linear infinite;
}

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

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.btn-outline {
    padding: 12px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.btn-outline-sm {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-outline-sm:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.btn-delete {
    color: #ef4444;
}

.btn-delete:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-secondary);
}

/* Gallery */
.gallery-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.gallery-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state svg {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Image Card */
.image-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-card:hover {
    border-color: rgba(168, 85, 247, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px var(--shadow);
}

.image-container {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-card:hover .image-container img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card:hover .image-overlay {
    opacity: 1;
}

.image-info {
    padding: 16px;
}

.image-prompt {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.style-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.image-actions {
    display: flex;
    gap: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px var(--shadow);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

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

.toast.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

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

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .user-name {
        display: none;
    }
    
    .main-content {
        padding: 20px 16px;
    }
    
    .login-card {
        padding: 32px 24px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .btn-outline {
        width: 100%;
        justify-content: center;
    }
    
    .toast {
        right: 16px;
        left: 16px;
        bottom: 16px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.footer {
  width: 100%;
  background: #f3f4f6;
  color: #333;
  padding: 18px 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 40px;
}

.footer-content {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.6;
}

    /* Section Judul dan Deskripsi */
    .section-info {
        max-width: 780px;
        margin: 40px auto 32px auto;
        padding: 32px 24px 28px 24px;
        background: #fff;
        border-radius: 20px;
        box-shadow: 0 6px 30px #0001;
        text-align: center;
        border: 1px solid #eaeaea;
    }
    .section-info h1 {
        margin: 0 0 16px 0;
        font-size: 2.2rem;
        font-weight: 700;
        color: #2851a3;
        letter-spacing: 0.5px;
    }
    .section-info p {
        font-size: 1.1rem;
        line-height: 1.7;
        color: #3a3a3a;
        margin-bottom: 0;
    }
    /* Section Cara Penggunaan */
    .usage-box {
        margin: 28px auto 18px auto;
        max-width: 600px;
        background: #f8fafc;
        border-radius: 16px;
        border: 1px solid #e6e6ee;
        box-shadow: 0 2px 7px #2061b013;
        padding: 22px 28px;
        text-align: left;
        font-size: 1.08rem;
    }
    .usage-box h2 {
        margin-top: 0;
        font-size: 1.25rem;
        color: #2061b0;
        font-weight: 600;
        margin-bottom: 14px;
    }
    .usage-steps {
        padding-left: 15px;
        margin: 0;
        color:#000000;
    }
    .usage-steps li {
        margin-bottom: 1px;
    }
    /* Responsive */
    @media (max-width: 500px) {
        .section-info {
            padding: 14px 6vw 12px 6vw;
        }
        .usage-box {
            padding: 9vw 5vw;
        }
    }