/* --- AESTHETIC PASTEL GLOBAL STYLES --- */
:root {
    --bg-color: #fdfaf5;
    --sidebar-bg: #e1f7f1; /* Pastel Mint */
    --accent-blue: #d6eaff; /* Pastel Blue */
    --accent-pink: #fbe0e6; /* Pastel Pink */
    --title-bar-bg: #ffe6d9; /* Pastel Peach */
    --text-primary: #5c677d;
    --text-secondary: #8d99ae;
    --border-radius: 16px;
    --font-bubbly: 'Fredoka One', cursive; /* Bubbly Cartoonish Font */
    --font-normal: 'Open Sans', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-normal);
    background-color: var(--bg-color);
    color: var(--text-primary);
    cursor: default; /* Fallback for custom cursor */
    overflow: hidden; /* Control scroll within main content area only */
}

/* --- MOUSE CURSOR TRAIL STYLE --- */
.trail-dot {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    pointer-events: none; /* Trail can't interfere with clicks */
    transition: transform 0.1s ease-out;
    z-index: 200;
}

/* --- AESTHETIC PARALLAX BACKGROUND - cartoon swirls --- */
.parallax-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, #ffe6d9 10%, transparent 10%), 
                radial-gradient(circle, #d6eaff 10%, transparent 10%);
    background-size: 100px 100px;
    background-position: 0 0, 50px 50px;
    opacity: 0.3;
    z-index: -2;
    animation: backgroundScroll 60s linear infinite;
}

@keyframes backgroundScroll {
    from { background-position: 0 0, 50px 50px; }
    to { background-position: 1000px 1000px, 1050px 1050px; }
}

/* --- APP LAYOUT --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.title-bar {
    background-color: var(--title-bar-bg);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid rgba(0,0,0,0.05);
    z-index: 10;
}

.title-bar h1 {
    font-family: var(--font-bubbly);
    margin: 0;
    font-size: 1.5rem;
    color: #df9e81; /* Darker peach text */
}

.title-bar .icon { font-size: 1.8rem; }

/* PASTEL BUTTONS & INTERACTION EFFECTS */
.pastel-btn, .nav-item, .generate-btn, .file-input-wrapper {
    transition: all 0.2s ease-out;
    border: none;
    cursor: pointer;
    font-family: var(--font-normal);
    font-weight: 600;
}

/* Clicking Effects - Cartoonish Swell */
.action-btn:active {
    transform: scale(0.96); 
}

/* Hover Effects - Pastel Blue Glow */
.action-btn:hover {
    box-shadow: 0 0 15px rgba(214, 234, 255, 0.7); 
}

.pastel-btn {
    background-color: var(--accent-pink);
    padding: 8px 16px;
    border-radius: 20px;
    color: #cf8493;
}

.title-bar #show-guide:hover {
    box-shadow: 0 0 15px rgba(251, 224, 230, 0.7); /* Pastel Pink Glow */
}

.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* SIDEBAR STYLES */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    border-right: 3px solid rgba(0,0,0,0.05);
}

.nav-item {
    background: none;
    text-align: left;
    padding: 15px 25px;
    color: #6ea99a; /* Darker mint */
    display: flex;
    align-items: center;
}

.nav-item .icon { margin-right: 15px; font-size: 1.2rem; }

.nav-item:hover, .nav-item.active {
    background-color: rgba(255, 255, 255, 0.4);
    color: #4a776c;
}

/* MAIN CONTENT & SCROLLING STYLES */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto; /* Independent scrolling effect within main panel */
    background-color: rgba(255,255,255,0.5);
    display: flex;
    flex-direction: column;
}

section { display: none; margin-bottom: 20px; }
section.active-section { display: block; }

h2 {
    font-family: var(--font-bubbly);
    color: #a4c6e9; /* Darker pastel blue */
    margin-top: 0;
}

textarea {
    width: 100%;
    height: 100px;
    border: 2px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 15px;
    font-family: var(--font-normal);
    resize: none;
    background-color: rgba(255,255,255,0.7);
    box-sizing: border-box;
}

textarea:focus { outline: none; border-color: #a4c6e9; }

.generate-btn, .file-input-wrapper {
    background-color: var(--accent-blue);
    padding: 12px 24px;
    border-radius: 25px;
    color: #5c677d;
    margin-top: 15px;
    font-weight: 700;
    display: inline-block;
}

.file-input-wrapper { position: relative; overflow: hidden; }
.file-input-wrapper input[type=file] {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}

/* --- PREVIEW / OUTPUT AREA STYLES --- */
.preview-panel {
    margin-top: auto;
    background-color: rgba(255,255,255,0.8);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 3px solid var(--accent-pink);
}

.preview-panel h3 { margin-top: 0; font-family: var(--font-bubbly); color: #cf8493; }

.animated-frame {
    height: 300px;
    border-radius: 12px;
    background-color: #fdfaf5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border: 2px dashed var(--text-secondary);
}

/* Swell/Generating Swell Animation on Frame */
.animated-frame.generating-active {
    box-shadow: 0 0 25px rgba(214, 234, 255, 0.9);
}

.placeholder-text { color: var(--text-secondary); font-style: italic; }

/* MODAL / POPUP STYLES */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.4);
    display: none; /* Controlled by JS */
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-overlay.active-modal { display: flex; }

.modal-content {
    background-color: var(--bg-color);
    width: 500px;
    max-width: 90%;
    border-radius: 20px;
    border: 4px solid var(--accent-pink);
    overflow: hidden;
    position: relative;
}

.modal-header {
    background-color: var(--accent-pink);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; font-family: var(--font-bubbly); color: #cf8493; }

.close-modal {
    background: none; border: none; font-size: 2rem; color: #cf8493; cursor: pointer; line-height: 1;
}

.modal-body { padding: 20px; }

.guide-steps { margin: 15px 0; }
.step { display: flex; margin-bottom: 12px; font-size: 0.9rem; }

.step-num {
    background-color: var(--accent-blue);
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-right: 12px;
    font-weight: 700; color: #5c677d; flex-shrink: 0;
}

#api-url {
    width: 100%;
    border-radius: 20px;
    padding: 10px 15px;
    border: 2px solid var(--accent-blue);
    margin: 10px 0;
    box-sizing: border-box;
}

.save-btn { background-color: var(--accent-pink); width: 100%; color: white; }

/* --- ANIMATIONS --- */
/* Smooth Swell Animation for Popups */
.cartoonish-swell {
    animation: swellOpen 0.3s ease-out forwards;
}

@keyframes swellOpen {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Loading Spinner */
.status-text { margin-bottom: 10px; color: var(--accent-blue); }
.loading-spinner {
    border: 4px solid rgba(214, 234, 255, 0.3);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    width: 30px; height: 30px;
    animation: spin 1s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }