:root {
    --primary-green: #28a745;
    --dark-green-hover: #218838;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --gray: #dee2e6;
    --dark-gray: #e9ecef;
    --text-color: #343a40;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background-color: var(--dark-gray); }
body {
    font-family: var(--font-family);
    background-color: var(--dark-gray);
    color: var(--text-color);
    line-height: 1.6;
}
body.modal-open {
    overflow: hidden;
}
.app-wrapper {
    display: flex;
}

.sidebar {
    width: 260px;
    height: 100vh;
    background-color: var(--white);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--gray);
    position: sticky;
    top: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray);
}

.sidebar-header button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header button:hover {
    background-color: var(--light-gray);
}

.sidebar-header svg {
    width: 24px;
    height: 24px;
    fill: #495057;
}

.sidebar-footer {
    padding-top: 1rem;
    margin-top: auto; /* Pushes the footer to the bottom */
    border-top: 1px solid var(--gray);
}

.sidebar-btn {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--gray);
    background-color: var(--light-gray);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-btn:hover {
    background-color: #e63946; /* A reddish color for a destructive action */
    border-color: #e63946;
    color: var(--white);
}

.session-history {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 1rem;
}

#session-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}


#session-history-list li a {
    display: block;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none; /* Removes the underline */
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s, color 0.2s;
}

#session-history-list li a:hover {
    background-color: var(--dark-gray);
}

#session-history-list li a.active {
    background-color: var(--primary-green);
    color: var(--white);
    font-weight: 600;
}


.container {
    width: 100%;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* The mobile header is hidden by default on larger screens */
.mobile-header {
    display: none;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 1.5rem;
}

#menu-toggle-btn {
    background: none;
    border: 1px solid var(--gray);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
}

#menu-toggle-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: #495057;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
    z-index: 1999; /* Below the sidebar (2000), but above everything else */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.sidebar-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.sidebar-tips {
    margin-top: auto; /* Pushes this section down */
    padding: 1rem 0.5rem;
    font-size: 0.8rem;
    color: #6c757d; /* A muted text color */
    line-height: 1.5;
    border-top: 1px solid var(--gray);
}

.sidebar-tips ul {
    list-style-position: inside;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
}

header { text-align: center; margin-bottom: 2.5rem; }
header h1 { font-weight: 700; color: var(--primary-green); font-size: 2.5rem; }
header p { font-size: 1.1rem; color: #6c757d; }
#recommendation-form { background: var(--white); padding: 2rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow); margin-bottom: 3rem; }
.form-group { margin-bottom: 1.5rem; }
/* ... (The rest of your CSS for cards, modals, etc. remains the same) ... */
.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
textarea { width: 100%; padding: 0.75rem; font-family: var(--font-family); font-size: 1rem; border: 1px solid var(--gray); border-radius: 8px; resize: none; transition: border-color 0.2s, box-shadow 0.2s; }
textarea:focus { outline: none; border-color: var(--primary-green); box-shadow: 0 0 0 3px #28a74533; }
/* --- Style for input hint text --- */
.input-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d; /* Muted gray color */
}
.category-buttons-container { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.category-btn { background-color: var(--white); color: var(--text-color); border: 1px solid var(--gray); padding: 0.5rem 1rem; border-radius: 20px; cursor: pointer; font-weight: 600; transition: all 0.2s ease-in-out; }
.category-btn:hover { background-color: var(--light-gray); }
.category-btn.active { background-color: var(--primary-green); color: var(--white); border-color: var(--primary-green); }
#search-context-display {
    text-align: center;
    margin-top: 1.5rem;
    min-height: 2rem; /* Reserve space to prevent layout shift */
}

.search-context-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.tag-pill {
    background-color: var(--dark-gray);
    color: var(--text-color);
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}
.submit-btn { display: block; width: 100%; padding: 0.85rem; font-size: 1.1rem; font-weight: 600; color: var(--white); background-color: var(--primary-green); border: none; border-radius: 8px; cursor: pointer; transition: background-color 0.2s; margin-top: 1rem; }
.submit-btn:hover { background-color: var(--dark-green-hover); }
.discovery-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: #386641; /* A darker green for text */
    background-color: #e9f7ec; /* A very light green */
    border-left: 5px solid var(--primary-green);
    border-radius: 8px;
}

.discovery-notice .fa-star {
    color: var(--primary-green);
}
.results-container h2 { font-size: 1.8rem; margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--gray); }
.no-results { text-align: center; font-size: 1.1rem; color: #6c757d; padding: 2rem; background: #fff; border-radius: var(--border-radius); }
.recommendations-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.rec-card { background-color: var(--white); border-radius: var(--border-radius); box-shadow: var(--box-shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; }
.rec-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.rec-card-img { width: 100%; height: 160px; object-fit: cover; }
.rec-card-content { padding: 1rem 1.25rem; display: flex; flex-direction: column; flex-grow: 1; }
.rec-card-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.25rem; }
.rec-card-genre { font-size: 0.9rem; color: #6c757d; margin-bottom: 0.75rem; }
.rec-card-description { font-size: 0.9rem; margin-bottom: 1rem; flex-grow: 1; }
.rec-card-context { font-size: 0.85rem; font-style: italic; color: #6c757d; margin-bottom: 1rem; }
.rec-card-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tag-link { background-color: var(--light-gray); color: #495057; font-size: 0.8rem; padding: 0.25rem 0.75rem; border-radius: 12px; text-decoration: none; transition: background-color 0.2s; }
.tag-link:hover { background-color: var(--primary-green); color: var(--white); }
.view-more-btn { align-self: flex-end; background: none; border: none; color: var(--primary-green); font-weight: 600; cursor: pointer; padding: 0.5rem 0; }
.pagination-container { text-align: center; margin-top: 2.5rem; }
.load-more-btn { display: inline-block; padding: 0.75rem 2.5rem; font-size: 1.1rem; font-weight: 600; color: var(--white); background-color: var(--primary-green); border: none; border-radius: 8px; cursor: pointer; text-decoration: none; transition: background-color 0.2s; }
.load-more-btn:hover { background-color: var(--dark-green-hover); }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; z-index: 1000; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { background: var(--white); padding: 2rem; border-radius: var(--border-radius); width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; position: relative; transform: translateY(-20px); transition: transform 0.3s; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 2rem; color: #aaa; cursor: pointer; line-height: 1; }
#modal-body {
    display: block; 
}
.modal-img { width: 35%; max-width: 250px; height: auto; object-fit: contain; border-radius: 8px; }
.modal-img-top { 
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.modal-text-content { width: 100%; }
#modal-body h2 { font-size: 2rem; margin-bottom: 1rem; }
#modal-body h3 { font-size: 1.1rem; font-weight: 600; color: var(--primary-green); margin-top: 1.5rem; margin-bottom: 0.5rem; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 0.75rem; }
#modal-body dl { margin-top: 0.5rem; }
#modal-body dt { font-weight: 600; text-transform: capitalize; }
#modal-body dd { margin-left: 1rem; margin-bottom: 0.5rem; color: #495057; }
.extra-data-container { background-color: var(--light-gray); border-radius: var(--border-radius); padding: 1rem 1.5rem; margin-top: 1.5rem; }
.extra-data-container h3 { color: var(--text-color) !important; margin-top: 0 !important; }
.extra-data-container dl dt { color: #6c757d; }
.extra-data-pre { font-family: inherit; font-size: 0.9rem; color: var(--text-color); white-space: pre-wrap; word-break: break-word; margin: 0; padding-top: 0.5rem; }
.toggle-extra-data {
    background: none;
    border: none;
    color: var(--primary-green);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-top: 0.5rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
}
.modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--gray); }
.footer-meta { font-size: 0.9rem; color: #6c757d; font-style: italic; }
.footer-actions { display: flex; gap: 0.75rem; }
.footer-actions button { padding: 0.5rem 1rem; border: 1px solid var(--gray); background-color: #fff; border-radius: 20px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.footer-actions button:hover { border-color: #343a40; background-color: var(--light-gray); }
.footer-tip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.5rem 0; /* Add some space above */
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #6c757d; /* Muted text color */
    border-top: 1px solid var(--gray);
}
.btn-reaction { font-size: 1rem; }
.modal-action-btn { border-color: var(--primary-green); color: var(--primary-green); }
.modal-action-btn:hover { background-color: var(--primary-green); color: #fff; }
.modal-action-btn.achieved { background-color: var(--primary-green); color: #fff; cursor: not-allowed; opacity: 0.7; }
.modal-action-btn.achieved::before { content: '✔ '; font-weight: bold; }
.skeleton-card { background-color: #fff; border-color: #e0e0e0; }
.skeleton { background-color: #e0e0e0; border-radius: 4px; animation: shimmer 1.5s infinite linear; background: linear-gradient(to right, #e0e0e0 8%, #f0f0f0 18%, #e0e0e0 33%); background-size: 1200px 100%; }
@keyframes shimmer { 0% { background-position: -1200px 0; } 100% { background-position: 1200px 0; } }
.skeleton-img { width: 100%; height: 160px; margin-bottom: 1rem; }
.skeleton-title { width: 60%; height: 1.2rem; margin-bottom: 0.75rem; }
.skeleton-text { width: 90%; height: 0.9rem; margin-bottom: 0.5rem; }
.skeleton-text.short { width: 70%; }
.error-message { text-align: center; grid-column: 1 / -1; padding: 2rem; color: #c0392b; font-weight: 600; }
@media (max-width: 992px) {
    .app-wrapper {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        transform: translateX(-100%); /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }

    .sidebar.is-open {
        transform: translateX(0); /* Shown when .is-open class is added */
    }

    .mobile-header {
        display: flex; /* Show the hamburger menu button */
    }

    .container {
        margin: 1rem auto; /* Adjust margin for mobile */
    }
}
@media (min-width: 768px) {
    .recommendations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}