/* style.css */
:root {
    --bg-color: #121212;
    --primary-text: #f0f0f0;
    --secondary-text: #aaa;
    --surface-color: #1e1e1e;
    --accent-blue: #00aaff;
    --border-color: #333;
}

body {
    font-family: 'Helvetica', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-text);
    margin: 0;
    transition: all 0.3s ease-in-out;
}

/* --- STATE 1: Initial Centered Layout --- */

body.initial-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

body.initial-view #sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    box-sizing: border-box;
}

body.initial-view #main-content {
    display: none; /* Hide gallery on initial load */
}

/* --- STATE 2: Gallery Sidebar Layout --- */

body.gallery-view {
    display: flex;
    flex-direction: row;
}

body.gallery-view #sidebar {
    width: 300px; /* Fixed sidebar width */
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--surface-color); /* Give sidebar a slight background */
    padding: 20px;
    box-sizing: border-box;
}

body.gallery-view #main-content {
    display: block;
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* --- Shared Component Styles --- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    /* In gallery view, make it stack nicely */
    flex-direction: column;
}

body.gallery-view .site-header {
    align-items: flex-start; /* Align to left in sidebar */
    flex-direction: row; /* Go back to horizontal */
}

.logo {
    width: 60px;
    height: 60px;
}

.title {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--primary-text);
    margin: 0;
}

body.gallery-view .title {
    font-size: 1.8rem; /* Smaller title in sidebar */
}

.search-wrapper {
    position: relative;
    width: 100%;
}

body.initial-view .search-wrapper {
    max-width: 800px;
    margin: 0 auto 30px auto;
}

#search-box {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    font-family: 'Helvetica', Arial, sans-serif;
    background-color: var(--bg-color); /* Darker than sidebar bg */
    color: var(--primary-text);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    box-sizing: border-box; 
    outline: none;
    transition: border-color 0.3s;
}

#search-box:focus {
    border-color: var(--accent-blue);
}

#autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
    /* --- FIX: Rounded bottom corners --- */
    border-radius: 0 0 30px 30px;
    overflow: hidden; /* Clips children to the rounded border */
}

.autocomplete-item {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--secondary-text);
}

.autocomplete-item:hover {
    background-color: var(--border-color);
    color: var(--accent-blue);
}

#gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    max-width: 1800px; /* Widen max gallery */
    margin: 0 auto;
}

.gallery-item {
    width: 100%;
    height: auto;
    border-radius: 8px;
    background-color: var(--surface-color);
    object-fit: contain;
    transition: transform 0.2s;
}

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

#loading-indicator {
    text-align: center;
    font-size: 1.2rem;
    color: var(--secondary-text);
    padding: 40px;
}

.hidden {
    display: none;
}