:root {
    --bg-color: #f4f5f7;
    --panel-bg-color: #ffffff;
    --surface-color: #f4f5f7;
    --primary-color: #28a745;
    --text-color: #111827;
    --text-secondary-color: #6b7280;
    --border-color: #e5e7eb;
    --font-family: 'Inter', sans-serif;
}

/* Base & Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

#app-container {
    display: flex;
    height: 100vh;
}

#control-panel {
    width: 400px;
    background-color: var(--panel-bg-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

#control-panel header {
    margin-bottom: 2rem;
}

#control-panel h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

#display-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Align items vertically */
    gap: 1.5rem;
    padding: 2rem;
    position: relative;
}

#image-placeholder {
    width: 100%;
    flex-grow: 1; /* Allow placeholder to take up space */
    min-height: 200px; /* Ensure it doesn't collapse */
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary-color);
    font-size: 1.1rem;
}

#image-placeholder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Accordion */
.accordion {
    border-top: 1px solid var(--border-color);
    flex-grow: 1;
}
.accordion-item {
    border-bottom: 1px solid var(--border-color);
}
.accordion-header {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 1.5rem 0.5rem;
    cursor: pointer;
    position: relative;
}
.accordion-header::after {
    content: '▼';
    position: absolute;
    right: 5px;
    font-size: 1rem;
    transition: transform 0.2s;
}
.accordion-item.is-open .accordion-header::after {
    transform: rotate(180deg);
}
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 0.5rem;
}
.accordion-item.is-open .accordion-content {
    max-height: 1000px;
    padding: 0.5rem 0.5rem 1.5rem;
}

/* Controls */
.control-group {
    margin-bottom: 2rem;
}
.control-group > label {
    display: block;
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.segmented-control {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    width: 100%;
}
.segmented-control button {
    flex-grow: 1;
    padding: 0.8rem 0.5rem;
    background-color: var(--panel-bg-color);
    color: var(--text-secondary-color);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
    font-size: 1rem;
}
.segmented-control button:not(:last-child) {
    border-right: 1px solid var(--border-color);
}
.segmented-control button:hover {
    background-color: var(--surface-color);
}
.segmented-control button.active {
    background-color: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
}

.swatch-container {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 1rem;
}
.swatch {
    width: 40px;
    height: 40px;
}
.card-container {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 1rem;
}
.card {
    padding: 1rem;
}
.card p {
    font-size: 1rem;
}
.card .icon {
    font-size: 2rem;
}
.styled-select {
    padding: 0.85rem;
    font-size: 1.1rem;
}
.makeup-group {
    margin-bottom: 2rem;
}
.makeup-group > label {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}
.slider-control {
    margin-bottom: 1.5rem;
}
.slider-label label {
    font-size: 1rem;
}
.slider-label span {
    font-size: 1rem;
}

/* Prompt Display */
#prompt-display {
    width: 100%;
    height: 200px; /* Fixed height */
    flex-shrink: 0; /* Prevent shrinking */
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    white-space: pre-wrap;
    overflow-y: auto;
}

.copy-button {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--surface-color);
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 0.75rem;
    transition: background-color 0.2s;
}

.copy-button:hover {
    background-color: var(--border-color);
}

/* Main Button & Loading */
.generate-button {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: auto;
    transition: background-color 0.2s;
}
.generate-button:hover {
    background-color: #4338ca;
}

.hidden {
    display: none !important;
}

#loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s ease infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 900px) {
    #app-container {
        flex-direction: column;
        height: auto;
    }
    #control-panel {
        width: 100%;
        border-right: none;
        height: auto;
    }
}