/* --- BASE & VARIABLES --- */
:root {
    --bg-color: #0f0f11;
    --island-bg: rgba(30, 30, 34, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #888888;
    --accent-color: #595790; /* Bright yellow-green from your screenshot */
    --accent-hover: #4a487a;
    --input-bg: rgba(0, 0, 0, 0.4);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding-bottom: 150px; /* Space for the floating island */
    overflow-x: hidden;
}

/* --- HEADER --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: transparent;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
}

#login-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

#login-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

#user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* --- GALLERY (GRID LAYOUT) --- */
.gallery-container {
    padding: 20px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    align-items: start;
}

.gallery-image {
    width: 100%;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* --- GALLERY HOVER OVERLAY --- */
.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    display: block;
}

.image-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.gallery-item:hover .image-overlay {
    opacity: 1;
}

.overlay-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.overlay-btn:hover {
    background: white;
    color: black;
    transform: scale(1.1);
}

.overlay-btn.delete {
    color: #ff5555;
    border-color: rgba(255, 85, 85, 0.5);
}

.overlay-btn.delete:hover {
    background: #ff5555;
    color: white;
}

/* --- FLOATING CONTROL ISLAND --- */
.control-island-wrapper {
    position: fixed;
    bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 100;
    pointer-events: none; /* Lets you click through the empty space */
}

.control-island {
    pointer-events: auto; /* Re-enables clicking on the island itself */
    background: var(--island-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 24px;
    width: 90%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

/* Reference Image Preview */
.reference-section {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

#ref-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-ref {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prompt Input Bar */
.prompt-section {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--input-bg);
    padding: 10px 16px;
    border-radius: 16px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
}

#prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 16px;
    outline: none;
}

#prompt-input::placeholder {
    color: var(--text-muted);
}

/* Action Section (Dropdowns & Generate Button) */
.action-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.setting-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
}

.setting-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Customizing Select Dropdowns */
.select-styled {
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position-x: 95%;
    background-position-y: center;
    padding-right: 30px;
}

.select-styled option {
    background: #222;
    color: white;
}

/* The Generate Button */
.generate-btn {
    background: var(--accent-color);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s ease, background 0.2s;
}

.generate-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.generate-btn:active {
    transform: scale(0.98);
}

/* --- OVERLAYS & MODALS --- */
.hidden {
    display: none !important;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Fullscreen Image Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

.close-modal {
    position: absolute;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 16px;
}

.download-btn, .delete-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn { background: white; color: black; }
.delete-btn { background: rgba(255,0,0,0.2); color: #ff4444; border: 1px solid rgba(255,0,0,0.3); }