:root {
    --bg-dark: #050511;
    --primary: #6366f1;
    --accent: #a855f7;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ambient-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    background: #02020a;
}

.diffused-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: slowMorph 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    mix-blend-mode: screen;
}

.glow-1 {
    width: 90vw;
    height: 90vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    top: -40%;
    left: -20%;
    animation-delay: 0s;
    transform-origin: center center;
}

.glow-2 {
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.35) 0%, transparent 70%);
    bottom: -30%;
    right: -20%;
    animation-duration: 25s;
    animation-delay: -5s;
    transform-origin: bottom right;
}

.glow-3 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(8, 145, 178, 0.25) 0%, transparent 70%);
    top: 30%;
    left: 20%;
    animation: floatingGlow 30s infinite ease-in-out;
    filter: blur(120px);
}

.glow-4 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.2) 0%, transparent 70%);
    bottom: -10%;
    left: -10%;
    animation: floatingGlow 22s infinite reverse ease-in-out;
    opacity: 0.4;
}

@keyframes slowMorph {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(5%, 5%); }
}

@keyframes floatingGlow {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(10%, -5%) scale(1.1); }
    66% { transform: translate(-5%, 10%) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

#auth-container {
    width: 400px;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    z-index: 10;
    transition: transform 0.3s, opacity 0.3s;
}

.logo-circle {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.auth-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    padding: 5px;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--glass-border);
    color: #fff;
    font-weight: 600;
}

.auth-form { display: none; animation: slideUp 0.4s ease; }
.auth-form.active-form { display: block; }

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 14px 14px 14px 45px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
    background: rgba(0,0,0,0.4);
}

.glow-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.glow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.4);
}

#app-container {
    width: 95vw; height: 90vh;
    display: flex;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#app-container:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.sidebar { width: 280px; border-radius: 24px; display: flex; flex-direction: column; padding: 1.5rem; }

.sidebar-top-section { display: flex; flex-direction: column; gap: 15px; margin-bottom: 1.5rem; }
.brand-row { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.new-chat-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--glass-border); background: transparent; color: #fff; cursor: pointer; transition: 0.3s; }
.new-chat-btn:hover { background: var(--primary); border-color: var(--primary); }

.custom-model-selector {
    position: relative;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    transition: 0.3s;
}
.custom-model-selector:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); }
.selected-model { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; }
.model-dropdown-menu {
    position: absolute; top: 110%; left: 0; width: 100%;
    background: #1a1a2e; border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 5px; z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: slideUp 0.2s;
}
.model-option { padding: 10px; border-radius: 8px; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; transition: 0.2s; color: var(--text-muted); }
.model-option:hover { background: rgba(255,255,255,0.1); color: #fff; }
.model-option.active { background: linear-gradient(90deg, var(--primary), var(--accent)); color: #fff; }

.nav-menu { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1rem; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; text-decoration: none; color: var(--text-muted); font-size: 0.9rem; transition: 0.3s; background: rgba(255,255,255,0.02); }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item .badge { margin-left: auto; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 0.6rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.separator { height: 1px; background: var(--glass-border); margin: 1rem 0; }
.history-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1rem; letter-spacing: 1px; }

.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.chat-item { padding: 12px; border-radius: 10px; cursor: pointer; transition: 0.2s; color: var(--text-muted); font-size: 0.9rem; display: flex; justify-content: space-between; align-items: center; }
.chat-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-item:hover, .chat-item.active { background: rgba(255,255,255,0.08); color: #fff; }
.delete-chat-btn { opacity: 0; background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 1rem; padding: 4px; transition: 0.2s; }
.chat-item:hover .delete-chat-btn { opacity: 1; }
.delete-chat-btn:hover { transform: scale(1.2); }

.user-profile { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--glass-border); display: flex; align-items: center; gap: 12px; cursor: pointer; position: relative; }
.user-profile img { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.profile-menu { position: absolute; bottom: 100%; left: 0; width: 100%; background: #1a1a2e; border: 1px solid var(--glass-border); border-radius: 12px; padding: 8px; margin-bottom: 10px; animation: slideUp 0.2s; }
.menu-item { padding: 10px; border-radius: 8px; font-size: 0.9rem; display: flex; gap: 8px; align-items: center; cursor: pointer; transition: 0.2s; }
.menu-item:hover { background: rgba(255,255,255,0.1); }

.chat-area { flex: 1; display: flex; flex-direction: column; position: relative; max-width: 1000px; margin: 0 auto; width: 100%; }
.welcome-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.big-logo { font-size: 4rem; color: var(--glass-border); margin-bottom: 1rem; }
.suggestion-cards { display: flex; gap: 15px; margin-top: 2rem; }
.card { background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 1.5rem; border-radius: 16px; width: 180px; cursor: pointer; transition: 0.3s; font-size: 0.9rem; }
.card i { font-size: 1.5rem; color: var(--accent); display: block; margin-bottom: 10px; }
.card:hover { transform: translateY(-5px); border-color: var(--accent); }

.messages-scroll { flex: 1; overflow-y: auto; padding: 2rem 1rem; display: flex; flex-direction: column; gap: 20px; }
.message { max-width: 80%; display: flex; gap: 15px; animation: slideIn 0.3s ease; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.ai { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.avatar.me { background: #334155; }
.bubble { padding: 12px 18px; border-radius: 18px; font-size: 0.95rem; line-height: 1.6; background: var(--glass-bg); border: 1px solid var(--glass-border); }
.message.user .bubble { background: linear-gradient(135deg, var(--primary), var(--accent)); border: none; color: #fff; border-radius: 18px 18px 0 18px; }
.message.assistant .bubble { background: rgba(15, 23, 42, 0.6); border-radius: 0 18px 18px 18px; }

.chat-image {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    display: block;
}

.input-area-wrapper { padding: 1.5rem 0; width: 100%; }

#image-preview-container { margin-bottom: 10px; padding: 0 10px; animation: slideUp 0.3s; }
.preview-box { position: relative; display: inline-block; }
#preview-img { height: 80px; border-radius: 10px; border: 1px solid var(--primary); box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.remove-img-btn { position: absolute; top: -8px; right: -8px; background: var(--danger); color: white; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; }

.input-container { display: flex; align-items: flex-end; gap: 10px; padding: 10px; border-radius: 20px; background: rgba(30, 41, 59, 0.7); }
.input-container textarea { flex: 1; background: transparent; border: none; outline: none; color: #fff; resize: none; padding: 10px; max-height: 120px; }
.attach-btn, #send-btn { background: transparent; border: none; color: var(--text-muted); padding: 10px; cursor: pointer; transition: 0.3s; border-radius: 50%; }
.attach-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
#send-btn { background: #fff; color: #000; }
#send-btn:hover { transform: scale(1.1); box-shadow: 0 0 15px rgba(255,255,255,0.5); }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(-10px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.hidden { display: none !important; }
.fade-in { animation: fade-in 0.5s ease-in-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.bubble p { margin-bottom: 8px; }
.bubble code { background: rgba(0,0,0,0.3); padding: 2px 5px; border-radius: 4px; font-family: monospace; color: #f472b6; }
.bubble pre { background: #0f172a; padding: 10px; border-radius: 8px; overflow-x: auto; margin: 10px 0; }

.nav-menu {
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 1rem;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: 0.3s;
    background: rgba(255,255,255,0.02);
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item .badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.separator {
    height: 1px;
    background: var(--glass-border);
    margin: 1rem 0;
}

.history-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1rem; letter-spacing: 1px; }

.chat-list {
    flex: 1;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 8px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.chat-item {
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex; justify-content: space-between; align-items: center;
}

.chat-item-title {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}

.chat-item:hover, .chat-item.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.delete-chat-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: 0.2s;
}

.chat-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    transform: scale(1.2);
}

.user-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    position: relative;
}

.user-profile img { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.user-info h4 { font-size: 0.9rem; }
.user-info span { font-size: 0.75rem; color: var(--primary); }

.profile-menu {
    position: absolute;
    bottom: 100%; left: 0; width: 100%;
    background: #1a1a2e;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 10px;
    animation: slideUp 0.2s;
}

.menu-item {
    padding: 10px; border-radius: 8px;
    font-size: 0.9rem; display: flex; gap: 8px; align-items: center;
    cursor: pointer; transition: 0.2s;
}
.menu-item:hover { background: rgba(255,255,255,0.1); }
.menu-item.logout { color: #ef4444; }

.chat-area {
    flex: 1;
    display: flex; flex-direction: column;
    position: relative;
    max-width: 1000px; margin: 0 auto;
    width: 100%;
}

.welcome-container {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
}
.big-logo { font-size: 4rem; color: var(--glass-border); margin-bottom: 1rem; }

.model-selector-wrapper {
    position: relative;
    width: 250px;
    margin-bottom: 2rem;
}
.model-selector-wrapper i {
    position: absolute;
    left: 15px; top: 50%; transform: translateY(-50%);
    color: var(--accent);
    pointer-events: none;
}
.model-selector-wrapper .arrow-icon {
    left: auto; right: 15px;
    color: var(--text-muted);
}
.glass-select {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    transition: 0.3s;
}
.glass-select:hover {
    border-color: var(--accent);
    background: rgba(255,255,255,0.08);
}
.glass-select option {
    background: #0f172a;
    color: #fff;
    padding: 10px;
}

.suggestion-cards {
    display: flex; gap: 15px; margin-top: 1rem;
}
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 16px;
    width: 180px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.9rem;
}
.card i { font-size: 1.5rem; color: var(--accent); display: block; margin-bottom: 10px; }
.card:hover { transform: translateY(-5px); border-color: var(--accent); }

.messages-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
    display: flex; flex-direction: column; gap: 20px;
}

.message {
    max-width: 80%;
    display: flex; gap: 15px;
    animation: slideIn 0.3s ease;
}

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.avatar.ai { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.avatar.me { background: #334155; }

.bubble {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.message.user .bubble {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: #fff;
    border-radius: 18px 18px 0 18px;
}

.message.assistant .bubble {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 0 18px 18px 18px;
}

.input-area-wrapper {
    padding: 1.5rem 0;
    width: 100%;
}

.input-container {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(30, 41, 59, 0.7);
}

.input-container textarea {
    flex: 1;
    background: transparent; border: none; outline: none;
    color: #fff; resize: none; padding: 10px;
    max-height: 120px;
}

.attach-btn, #send-btn {
    background: transparent; border: none; color: var(--text-muted);
    padding: 10px; cursor: pointer; transition: 0.3s;
    border-radius: 50%;
}
.attach-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

#send-btn { background: #fff; color: #000; }
#send-btn:hover { transform: scale(1.1); box-shadow: 0 0 15px rgba(255,255,255,0.5); }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(-10px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.hidden { display: none !important; }
.fade-in { animation: fade-in 0.5s ease-in-out; }

.bubble p { margin-bottom: 8px; }
.bubble code { background: rgba(0,0,0,0.3); padding: 2px 5px; border-radius: 4px; font-family: monospace; color: #f472b6; }
.bubble pre { background: #0f172a; padding: 10px; border-radius: 8px; overflow-x: auto; margin: 10px 0; }
.bubble pre code { background: transparent; color: #e2e8f0; }

.image-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    overflow: hidden;
}

.image-sidebar-item:hover, .image-sidebar-item.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border);
}

.sidebar-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--glass-border);
}

.sidebar-prompt-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: all; }

.modal-container {
    width: 700px; height: 500px;
    border-radius: 20px;
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay:not(.hidden) .modal-container { transform: scale(1); }

.modal-header {
    padding: 1.5rem; border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.2rem; font-weight: 600; }
.close-modal-btn { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: 0.3s; }
.close-modal-btn:hover { color: #fff; transform: rotate(90deg); }

.modal-body { flex: 1; display: flex; overflow: hidden; }

/* Modal Sidebar */
.settings-sidebar {
    width: 200px; background: rgba(0,0,0,0.2);
    border-right: 1px solid var(--glass-border);
    padding: 1rem; display: flex; flex-direction: column; gap: 5px;
}
.settings-tab {
    background: transparent; border: none; color: var(--text-muted);
    padding: 12px; text-align: left; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 0.9rem; transition: 0.2s;
}
.settings-tab:hover { background: rgba(255,255,255,0.05); color: #fff; }
.settings-tab.active { background: linear-gradient(90deg, var(--primary), transparent); color: #fff; }

/* Modal Content */
.settings-content { flex: 1; padding: 2rem; overflow-y: auto; position: relative; }
.settings-panel { display: none; animation: slideIn 0.3s; }
.settings-panel.active-panel { display: block; }

.setting-group { margin-bottom: 2rem; }
.setting-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.setting-header label { font-weight: 600; font-size: 1rem; }
.setting-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; line-height: 1.4; }
.value-badge { background: var(--glass-border); padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; font-family: monospace; color: var(--accent); }

.glass-input {
    width: 100%; padding: 12px; background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border); border-radius: 8px; color: #fff; outline: none;
}
.save-btn { width: auto; padding: 10px 25px; margin-top: 1rem; }

.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #334155; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(24px); }

input[type=range] {
    -webkit-appearance: none; width: 100%; height: 6px; background: #334155;
    border-radius: 5px; outline: none; opacity: 0.7; transition: .2s;
}
input[type=range]:hover { opacity: 1; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
    background: var(--accent); border-radius: 50%; cursor: pointer; box-shadow: 0 0 10px var(--accent);
}
.image-generation-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
}

.image-display-wrapper {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.generated-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
}

.generated-image.loaded {
    opacity: 1;
}

.image-placeholder {
    text-align: center;
    color: var(--glass-border);
    animation: pulseIcon 3s infinite;
}
.image-placeholder i { font-size: 5rem; display: block; margin-bottom: 1rem; }
.image-placeholder span { font-size: 1.2rem; letter-spacing: 2px; }

@keyframes pulseIcon {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

.prompt-input-wrapper {
    width: 100%;
    max-width: 800px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 10px;
    display: flex;
    gap: 10px;
    backdrop-filter: blur(30px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.prompt-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 15px;
    resize: none;
    outline: none;
    font-size: 1rem;
    height: 60px;
}

.generate-btn {
    background: linear-gradient(135deg, #f43f5e, #a855f7);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 0 30px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.5);
}

.generate-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
}

.result-info {
    width: 100%;
    max-width: 600px;
    margin-top: -1rem;
    margin-bottom: 2rem;
    background: rgba(0,0,0,0.4);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.result-info.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-info h4 { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 1px; }
.result-info p { color: #fff; font-size: 1rem; line-height: 1.5; font-style: italic; }

.loading-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.magic-loader {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #f43f5e;
    border-right-color: #a855f7;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 15px;
    background: linear-gradient(90deg, #f43f5e, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 1.1rem;
    animation: pulse 1.5s infinite;
}

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