:root {
    --primary-color: #2c3e50; /* Dark Blue */
    --secondary-color: #3498db; /* Bright Blue */
    --background-color: #f4f6f9; /* Light Grey */
    --font-color: #333;
    --light-color: #ffffff;
    --danger-color: #e74c3c;
    --edit-color: #f39c12;
    --success-color: #27ae60;
    --border-color: #e0e4e8;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--font-color);
    margin: 0;
    padding-top: 60px;
}
input, button, textarea {
    font-family: inherit;
    font-size: 1rem;
}

/* --- Header --- */
.main-header { width: 100%; background-color: var(--light-color); box-shadow: 0 2px 4px rgba(0,0,0,0.05); padding: 0 20px; box-sizing: border-box; position: fixed; top: 0; left: 0; z-index: 1000; }
.header-content { display: flex; align-items: center; max-width: 1400px; margin: 0 auto; height: 60px; }
.header-title-link { text-decoration: none; color: var(--primary-color); margin-right: auto; }
.header-title-link h1 { margin: 0; font-size: 1.5rem; }
.main-nav { display: flex; gap: 15px; }
.nav-link-button { text-decoration: none; color: var(--primary-color); font-weight: 500; padding: 8px 12px; border-radius: 6px; }
#auth-state-container { margin-left: auto; display: flex; align-items: center; }
#guest-signin-btn { background-color: var(--secondary-color); color: white; border: none; padding: 8px 15px; border-radius: 8px; cursor: pointer; font-weight: bold; }
#user-info { display: none; align-items: center; gap: 10px; }
#logout-btn { background: none; border: none; color: var(--danger-color); font-weight: bold; cursor: pointer; margin-left: 15px; }

/* --- Intro & Ad Section --- */
.content-wrapper { max-width: 1400px; margin: 20px auto 0 auto; padding: 0 20px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.intro-text { width: 100%; max-width: 1000px; text-align: center; background-color: var(--light-color); padding: 20px 30px; border-radius: 8px; border: 1px solid var(--border-color); box-sizing: border-box; }
.intro-text h2 { font-size: 2rem; color: var(--primary-color); margin-top: 0; }
.intro-text p { font-size: 1.1rem; line-height: 1.6; color: #555; margin-bottom: 0; }
.ad-placeholder { width: 100%; background: #e9ecef; border: 1px solid var(--border-color); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #adb5bd; box-sizing: border-box; }
.ad-placeholder.banner-ad { height: 90px; max-width: 728px; }

/* --- Main Layout --- */
#page-wrapper { display: flex; gap: 20px; padding: 20px; max-width: 1400px; margin: 0 auto; align-items: flex-start; }
.sidebar { background-color: var(--light-color); border-radius: 8px; border: 1px solid var(--border-color); flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar-left { width: 350px; }
.sidebar-right { width: 300px; background: none; border: none; display: flex; flex-direction: column; gap: 20px; }
.sidebar-right .ad-placeholder { height: 300px; }
#main-content { flex-grow: 1; }

/* --- Wheel Assembly --- */
.wheel-assembly { position: relative; display: flex; flex-direction: column; align-items: center; }
.wheel-pointer { position: absolute; top: 45%; right: 40px; transform: translateY(-50%); width: 30px; height: 30px; background: var(--danger-color); clip-path: polygon(100% 0, 100% 100%, 0 50%); z-index: 10; }
.wheel-container { position: relative; width: 100%; max-width: 600px; aspect-ratio: 1 / 1; }
#wheel-canvas { width: 100%; height: 100%; }
.action-buttons-container { margin-top: 20px; display: flex; gap: 15px; }
#spin-button, #share-btn { padding: 12px 25px; font-size: 1.2rem; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; color: white; }
#spin-button { background-color: var(--success-color); }
#share-btn { background-color: var(--secondary-color); }
#spin-button:disabled { background-color: #bdc3c7; cursor: not-allowed; }

/* --- Sidebar --- */
.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.tab-link { flex: 1; padding: 15px; background: #f8f9fa; border: none; cursor: pointer; font-weight: 500; font-size: 1rem; color: #666; }
.tab-link.active { background: var(--light-color); color: var(--primary-color); border-bottom: 2px solid var(--secondary-color); }
.sidebar-content { padding: 20px; height: calc(100vh - 180px); overflow-y: auto; }
.form-group, .filter-container { display: flex; flex-direction: column; gap: 10px; }
.add-buttons-container { display: flex; gap: 10px; }
.add-buttons-container button { flex: 1; padding: 12px; border-radius: 6px; border: none; font-weight: bold; font-size: 1rem; color: white; }
#add-from-google-btn { background-color: var(--secondary-color); }
#add-from-google-btn:disabled { background-color: #bdc3c7; cursor: not-allowed; }
#add-manually-btn { background-color: #7f8c8d; }
#restaurant-list, #item-list, #history-list { list-style: none; padding: 0; margin-top: 15px; }
#restaurant-list li, #item-list li { display: flex; align-items: center; padding: 12px 5px; border-bottom: 1px solid #f0f0f0; }
.restaurant-info, .item-info { flex-grow: 1; display: flex; flex-direction: column; }
.restaurant-info strong, .item-info strong { font-weight: 600; }
.restaurant-info small, .item-info small { color: #888; font-size: 0.9em; }
.list-item-buttons { display: flex; gap: 5px; }
.list-item-buttons button { background: none; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.list-item-buttons button:hover { opacity: 1; }
.delete-btn { color: var(--danger-color); }
.edit-btn { color: var(--edit-color); }

.sidebar-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px; /* Add space for the line */
    border-bottom: 1px solid var(--border-color); /* The line itself */
}

.list-header h3 {
    margin: 0;
}
#clear-all-btn {
    background: none;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}
#clear-all-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* FIX: Styles to arrange filters in a single, wrapping line */
#star-filter-container {
    display: flex;
    justify-content: space-between;
    text-align: center;
}

#star-filter-container label {
    display: flex;
    flex-direction: column; /* Stacks the checkbox on top of the text */
    align-items: center;   /* Horizontally centers the items */
    font-size: 0.9rem;
    cursor: pointer;
}

/* --- Popups --- */
.popup-overlay, .panel { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.popup-content, .login-box, .panel-box { background: white; padding: 30px; border-radius: 8px; text-align: center; box-shadow: 0 5px 15px rgba(0,0,0,0.3); position: relative; width: 90%; max-width: 400px; }
.close-popup-btn, .close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 28px; cursor: pointer; color: #aaa; }
#result-popup h2 { font-size: 2.5rem; color: var(--primary-color); margin-top: 5px; margin-bottom: 25px; word-wrap: break-word; overflow-wrap: break-word;}
.popup-buttons { display: flex; gap: 10px; margin-top: 20px; }
.popup-buttons button { flex: 1; padding: 12px; border-radius: 8px; border: none; font-weight: bold; font-size: 1rem; cursor: pointer; color: white; }
#respin-btn { background-color: var(--edit-color); }
#accept-btn, #submit-rating-btn { background-color: var(--success-color); }
#close-winner-btn { background-color: #6c757d; }
#remove-winner-btn { background-color: var(--danger-color); }
#google-signin-btn { background-color: #4285F4; color: white; padding: 12px 25px; font-size: 1rem; border: none; border-radius: 5px; cursor: pointer; margin-top: 10px; font-weight: bold; }

/* --- Static Pages & Blog --- */
.static-page #main-content { width: 100%; }
.content-page { background: var(--light-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 2rem 3rem; line-height: 1.7; }
.blog-post-item { padding: 2rem 0; border-bottom: 1px solid var(--border-color); }
.blog-post-item:last-child { border-bottom: none; }
.blog-post-item h3 a { color: var(--primary-color); text-decoration: none; font-size: 1.75rem; transition: color 0.2s; }
.blog-post-item h3 a:hover { color: var(--secondary-color); }
.post-meta { font-size: 0.9rem; color: #888; margin-bottom: 1rem; }
.read-more-link { display: inline-block; margin-top: 1rem; font-weight: bold; color: var(--secondary-color); }

/* --- Footer --- */
.main-footer { text-align: center; padding: 20px; margin-top: 40px; color: #777; border-top: 1px solid var(--border-color); }
.main-footer p { margin: 0 0 10px 0; }
.main-footer a { color: var(--primary-color); text-decoration: none; margin: 0 10px; }

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .header-content { flex-wrap: wrap; height: auto; padding: 10px 0; }
    .main-nav { flex-basis: 100%; order: 3; justify-content: space-around; margin: 10px 0 0 0; }
    .content-wrapper { margin-top: 10px; }
    #page-wrapper { flex-direction: column; padding: 10px; }
    .sidebar-left, .sidebar-right { width: 100%; box-sizing: border-box; }
    .sidebar-right { display: none; }
    .sidebar-content { height: auto; max-height: 45vh; }
    .wheel-pointer { right: 0; }
}