/* --- THEME VARIABLES --- */
:root {
    /* Default Light Mode */
    --body-bg: #e4e6eb;
    --app-container-bg: #ffffff;
    --sidebar-bg: #f8f9fa;
    --accent-color: #1a1a1a;
    --accent-color-text: #ffffff;
    --text-color: #1a1a1a;
    --text-color-muted: #65676b;
    --border-color: #ccc;
    --input-bg: #dbe0e6; /* Darker gray for inputs in light mode */
    --error-color: #d32f2f;
    --success-color: #388e3c;
    --card-bg: #ffffff;
    
    --font-primary: 'Inter', sans-serif;
    --font-headline: 'Zilla Slab', serif;
}

[data-theme="dark"] {
    /* Dark Mode */
    --body-bg: #000000;
    --app-container-bg: #1a1a1a;
    --sidebar-bg: #2a2a2a;
    --accent-color: #ffffff;
    --accent-color-text: #1a1a1a;
    --text-color: #f0f0f0;
    --text-color-muted: #a0a0a0;
    --border-color: #444;
    --input-bg: #1a1a1a;
    --error-color: #e57373;
    --success-color: #81c784;
    --card-bg: #2a2a2a;
}

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

/* Base Body Styles */
body {
    font-family: var(--font-primary);
    background-color: var(--body-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fix: Ensure html takes full height for centering */
html {
    height: 100%;
}

/* App Container (Generator) */
.app-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 80vh;
    min-height: 700px;
    background-color: var(--app-container-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease;
}

.sidebar {
    width: 400px;
    background-color: var(--sidebar-bg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: background-color 0.3s ease;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 20px;
}

.logo {
    font-family: var(--font-headline);
    font-size: 2rem;
    font-weight: 700;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* --- TOGGLE SLIDER CSS --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-color-muted);
}

.theme-label {
    margin-right: 8px;
    font-weight: 500;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Language Switcher */
.language-switcher button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color-muted);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 0.2rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.language-switcher button.active {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
    border-color: var(--accent-color);
}

.title {
    font-family: var(--font-headline);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-color-muted);
    margin-bottom: 2rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: border-color 0.2s ease, background-color 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.prompt-display {
    background-color: var(--input-bg);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    font-style: italic;
    color: var(--text-color-muted);
    font-size: 0.9rem;
}

.button {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--accent-color);
    color: var(--accent-color-text);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
    margin-top: 0.5rem;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

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

.button:not(:disabled):hover {
    opacity: 0.9;
}

.secondary-button {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.secondary-button:hover {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: var(--app-container-bg);
    transition: background-color 0.3s ease;
}

#image-placeholder {
    text-align: center;
    color: var(--text-color-muted);
}

.hidden {
    display: none !important;
}

#image-display {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#generated-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Order Form */
#order-form-container {
    animation: fadeIn 0.5s ease-in-out;
}

#order-image-preview {
    width: 100%;
    padding-top: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

#order-form-container h2 {
    font-family: var(--font-headline);
    margin-bottom: 1.5rem;
}

#payment-section {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
    flex-grow: 1;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group input {
    width: auto;
    margin-top: 5px;
}

/* Spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.spinner {
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/* --- CONFIRMATION VIEW STYLES --- */
.confirmation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--body-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in-out;
}

.confirmation-card {
    background-color: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.success-icon {
    width: 80px;
    height: 80px;
    background-color: var(--success-color);
    color: white;
    font-size: 3rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
}

.confirmation-card h1 {
    font-family: var(--font-headline);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.confirmation-details {
    background-color: var(--input-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    text-align: left;
}

.confirmation-details p {
    margin-bottom: 0.5rem;
}

.confirmation-details p:last-child {
    margin-bottom: 0;
}

.error-message {
    color: var(--error-color);
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- LANDING PAGE STYLES --- */
.landing-page {
    /* Critical Fix: Reset display/grid for landing page scrolling */
    display: block !important; 
    place-items: unset !important;
    height: auto !important;
    min-height: 100%;
    
    padding: 0;
    overflow-y: auto;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-section {
    text-align: center;
    padding: 6rem 2rem;
    background-color: var(--card-bg);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-content {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-family: var(--font-headline);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-color-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.cta-button {
    display: inline-block;
    background-color: var(--accent-color);
    color: var(--accent-color-text);
    padding: 1rem 2.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.cta-button:hover {
    transform: translateY(-2px);
}

/* How It Works */
.how-it-works {
    max-width: 1200px;
    margin: 4rem auto;
    padding: 0 2rem;
    text-align: center;
}

.how-it-works h2 {
    font-size: 2.5rem;
    font-family: var(--font-headline);
    margin-bottom: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.step-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-color);
    margin-bottom: 1rem;
    background-color: var(--input-bg);
    width: 60px;
    height: 60px;
    line-height: 60px;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

/* Gallery Grid */
.gallery-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.gallery-section h2 {
    font-size: 2.5rem;
    font-family: var(--font-headline);
    text-align: center;
    margin-bottom: 1rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-color-muted);
    margin-bottom: 3rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-color: var(--input-bg);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.order-btn {
    background: white;
    color: black;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
}

footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-color-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}