/* --- Base Styles --- */
/* Basic Reset & Body */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; /* Establish base font size */ }
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    transition: margin-right 0.3s ease-in-out; /* For sidebar push effect */
}
h2, h3, h4 { margin-bottom: 0.8em; color: #444; font-weight: 600; }
ul { list-style: none; padding-left: 0; }
li { margin-bottom: 0.5em; }
button, input, textarea, label { font-family: inherit; font-size: inherit; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Utility Classes */
.error-message { color: #dc3545; font-style: italic; }
.empty-view-message { color: #6c757d; font-style: italic; padding: 10px; text-align: center; }
/* Placeholder styling moved to Columns View section */


/* --- Top Navigation --- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 10px;
}
.tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto; /* Allow tabs to scroll if they don't fit */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ced4da #f8f9fa; /* Firefox */
    padding-bottom: 5px; /* Space for scrollbar */
}
/* Webkit scrollbar styles */
.tabs::-webkit-scrollbar { height: 5px; }
.tabs::-webkit-scrollbar-track { background: #f8f9fa; }
.tabs::-webkit-scrollbar-thumb { background-color: #ced4da; border-radius: 10px; border: 1px solid #f8f9fa; }

.tabs button.tab-link {
    padding: 10px 15px;
    margin-right: 5px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem; /* Use rem for scalability */
    border-bottom: 3px solid transparent;
    transition: border-color 0.3s ease, color 0.3s ease;
    white-space: nowrap;
    color: #495057;
}
.tabs button.tab-link:hover { color: #0056b3; }
.tabs button.tab-link.active { border-bottom-color: #007bff; color: #007bff; font-weight: 600; }

.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.btn {
    padding: 0.5rem 0.9rem; /* Use rem */
    cursor: pointer;
    border: 1px solid #ced4da;
    background-color: #f1f3f5;
    border-radius: 4px;
    font-size: 0.9rem; /* Use rem */
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.5; /* Ensure consistent height */
}
.btn:hover { background-color: #e9ecef; border-color: #adb5bd; }
.btn:focus-visible { outline: 2px solid #007bff; outline-offset: 2px; } /* Accessibility */
.btn-secondary { background-color: #007bff; color: white; border-color: #007bff; }
.btn-secondary:hover { background-color: #0056b3; border-color: #004085; }
.btn:disabled { background-color: #e9ecef; border-color: #ced4da; color: #6c757d; cursor: not-allowed; opacity: 0.7; }
.mode-switch { display: flex; align-items: center; font-size: 0.9rem; border: 1px solid #ced4da; border-radius: 4px; overflow: hidden; }
.mode-switch label { padding: 0.5rem 0.6rem; cursor: pointer; background-color: #f8f9fa; transition: background-color 0.3s ease; user-select: none; }
.mode-switch label:has(input:checked) { background-color: #cfe2ff; color: #052c65; }
.mode-switch input[type="radio"] { display: none; }

/* --- Profile Menu Dropdown --- */
.profile-menu-container { position: relative; }
.profile-dropdown { display: none; position: absolute; right: 0; top: 100%; background-color: white; border: 1px solid #dee2e6; border-radius: 4px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); min-width: 160px; z-index: 110; margin-top: 5px; }
.profile-dropdown a { display: block; padding: 10px 15px; color: #333; text-decoration: none; font-size: 0.9rem; }
.profile-dropdown a:hover { background-color: #f8f9fa; }
.profile-menu-container:hover .profile-dropdown,
.profile-menu-btn:focus + .profile-dropdown, /* Show on focus */
.profile-dropdown:focus-within { display: block; } /* Keep open if interacting within */
.profile-menu-btn i { margin-left: 5px; transition: transform 0.2s; display: inline-block; /* Prevents spacing issues */ }
.profile-menu-container:hover .profile-menu-btn i { transform: rotate(180deg); }

/* --- Main Content Area & Tabs --- */
.main-container { display: flex; }
/* MODIFIED: Added min-width: 0 to the main flex item */
main {
    padding: 20px;
    flex-grow: 1;
    transition: margin-right 0.3s ease-in-out; /* For sidebar push */
    min-width: 0; /* Prevent content like wide toolbars from expanding the flex item */
}
.tab-content { display: none; padding: 20px; background-color: #fff; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-top: 15px; }
.tab-content.active { display: block; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Tools Section --- */
.tools-section { margin-bottom: 30px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
/* Added max-width: 100% to constrain the scroll area */
.tools-scroll {
    overflow-x: auto;
    padding-bottom: 10px;
    max-width: 100%; /* Prevent this div from expanding beyond its container */
}
.tools-container {
    display: flex;
    gap: 15px;
    padding-top: 5px;
    min-width: min-content; /* Crucial for horizontal scroll to work correctly */
}
/* Base Tool Card Styles */
.tool-card {
    width: 150px; /* Slightly wider to accommodate elements */
    height: 150px; /* Slightly taller */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center text by default */
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    border: 1px solid transparent; /* Base border */
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
    position: relative; /* For positioning child elements like lock/time */
    overflow: hidden; /* Prevent content spillover */
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

/* --- Tool Type Specific Styles --- */
/* Tool 1: Exercise */
.tool-card.tool-exercise {
    background-color: #e0f7fa; /* Light Cyan/Blue */
    border-color: #b2ebf2;
    color: #00796b; /* Darker text for contrast */
}
.tool-card.tool-exercise:hover {
    background-color: #c0f0f5;
}

/* Tool 2: Exploration */
.tool-card.tool-exploration {
    background-color: #e8f5e9; /* Light Green */
    border-color: #c8e6c9;
    color: #2e7d32; /* Darker green text */
    justify-content: space-between; /* Space out progress, text, time */
    padding-top: 30px; /* Make space for progress bar */
    padding-bottom: 25px; /* Make space for time label */
}
.tool-card.tool-exploration:hover {
    background-color: #d8f0d9;
}

/* Tool 3: Inspiration */
.tool-card.tool-inspiration {
    background-color: #fffde7; /* Light Yellow */
    border-color: #fff9c4;
    color: #f57f17; /* Darker yellow/orange text */
}
.tool-card.tool-inspiration:hover {
    background-color: #fffbea;
}

/* --- Tool Card Elements Styles --- */
/* Lock Icon */
.tool-lock-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.85em;
    color: rgba(0, 0, 0, 0.3); /* Muted color */
}
/* Exploration: Progress Bar */
.tool-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px; /* Thinner bar */
    background-color: rgba(0, 0, 0, 0.1); /* Faint background */
    border-radius: 8px 8px 0 0; /* Match card radius */
    overflow: hidden;
}
.tool-progress {
    height: 100%;
    background-color: #4caf50; /* Green progress */
    transition: width 0.3s ease;
}
/* Exploration: Time Label */
.tool-time-label {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.75em; /* Smaller text */
    font-weight: bold;
    color: rgba(0, 0, 0, 0.5); /* Muted color */
    background-color: rgba(255, 255, 255, 0.6); /* Slight background */
    padding: 1px 5px;
    border-radius: 3px;
}


/* --- Main View Area & Switcher --- */
.main-view-area { margin-top: 20px; }
.view-switcher { margin-bottom: 20px; text-align: right; }
.view-switcher .view-btn { background: #f8f9fa; border: 1px solid #ced4da; padding: 8px 12px; margin-left: 5px; cursor: pointer; border-radius: 4px; font-size: 1.1rem; line-height: 1; color: #555; transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-switcher .view-btn:hover { background: #e9ecef; }
.view-switcher .view-btn.active { background: #007bff; color: white; border-color: #0056b3; }
.view-switcher .view-btn:focus-visible { outline: 2px solid #007bff; outline-offset: 1px; }

/* --- View Base Styles --- */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.5s ease-in-out; }

/* --- View 1: Columns (Enhanced "Boxes" View) using GRID --- START OF CHANGES --- */
.view-columns.active {
    display: grid; /* Change to grid */
    /* Define columns: Auto-fit columns with a min width, maxing at 1fr */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px; /* Keep the gap */
    padding: 10px;
    background-color: #f0f2f5; /* Keep background */
    border-radius: 6px; /* Keep border-radius */
     /* Optional: Control row height */
     /* grid-auto-rows: minmax(200px, auto); */ /* Example: Minimum row height */
}

/* Renamed .column to .category-box for clarity */
.view-columns .category-box {
    /* Remove flex properties if switching completely to grid for the container */
    /* flex: 1 1 280px; */ /* REMOVED */
    /* min-width: 250px; */ /* REMOVED - Handled by grid-template-columns */

    /* Keep other styles: background, padding, border, border-radius, shadow */
    background-color: #e9ecef; /* Light gray background for the box */
    padding: 20px; /* More padding */
    border-radius: 8px; /* More rounded corners */
    border: 1px solid #ced4da; /* Subtle border */
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); /* Subtle shadow */
    /* Ensure box itself doesn't prevent stretching if grid needs it */
    /* min-height: 200px; */ /* Optional: set a minimum height if needed */
}

.view-columns .category-box h4 {
    border-bottom: 1px solid #adb5bd; /* Stronger divider */
    padding-bottom: 12px;
    margin-bottom: 15px; /* More space below header */
    font-size: 1.1rem; /* Slightly larger header */
    color: #343a40; /* Darker header text */
}

.view-columns .category-box ul {
    padding-left: 0;
    min-height: 60px; /* Slightly increased min-height */
    border: none;
    background-color: transparent;
    padding: 0;
}

.view-columns .category-box li { /* Styling the cards */
    background-color: #ffffff; /* White background for cards */
    padding: 15px 18px; /* Increased padding */
    border: 1px solid #dee2e6; /* Standard card border */
    border-radius: 6px; /* Rounded corners for cards */
    margin-bottom: 12px; /* Increased space between cards */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.view-columns .category-box li:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transform: translateY(-2px); /* Add slight lift on hover */
    border-color: #adb5bd; /* Highlight border on hover */
}

/* Keep dragging styles simple */
.view-columns .category-box li.dragging {
    opacity: 0.6;
    background: #dcedff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: grabbing;
    transform: none; /* Disable hover transform while dragging */
}

/* Placeholder styling */
.empty-column-placeholder {
    color: #6c757d;
    font-style: italic;
    padding: 15px; /* Add padding */
    text-align: center;
    background-color: rgba(255, 255, 255, 0.5); /* Slight background */
    border-radius: 4px;
    margin-top: 10px;
}

/* Drag over styling for grid might need reconsideration */
.view-columns .category-box ul.drag-over {
   /* background-color: #e3f2fd; */ /* Style might not be desired on ul */
}

.view-columns .category-box li .item-text {
    flex-grow: 1;
    margin-right: 10px;
    color: #212529; /* Ensure good text contrast */
}
/* --- View 1: Columns (Enhanced "Boxes" View) using GRID --- END OF CHANGES --- */


/* --- View 2: Cards --- UPDATED */
.view-cards.active { display: flex; flex-wrap: wrap; gap: 20px; /* Increased gap */ }
.item-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    padding: 18px 20px; /* Increased padding */
    border-radius: 6px; /* Slightly more rounded */
    font-size: 1.05rem; /* Increased font size */
    flex: 1 1 280px; /* Base width 280px, more prominent */
    min-width: 250px; /* Minimum width */
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.07); /* Slightly more shadow */
    transition: box-shadow 0.2s ease;
}
.item-card:hover { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.item-card-content { flex-grow: 1; margin-right: 15px; overflow-wrap: break-word; word-break: break-word; }
.item-card span.category-label { font-weight: 600; color: #555; margin-right: 8px; display: block; margin-bottom: 4px; font-size: 0.9em; } /* Make label clearer */
.item-card span.item-text { color: #212529; }

/* --- View 3: Slideshow --- UPDATED */
.slideshow-container {
    position: relative;
    background-color: #f8f9fa; /* Base background */
    min-height: 200px; /* Increased height */
    text-align: center;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #eee;
    display: flex; /* Use flex for centering */
    align-items: center;
    justify-content: center;
}
.slideshow-container .slide {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 60px; /* Padding inside slide, leaves space for nav */
    min-height: 150px;
    position: absolute; /* Position slides absolutely within container */
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    color: #fff; /* Default text color, override per theme */
    opacity: 0; /* Start invisible for transition */
    transition: opacity 0.6s ease-in-out;
}
.slideshow-container .slide.active {
    display: flex; /* Shown when active */
    opacity: 1; /* Fade in */
    z-index: 1; /* Ensure active is on top */
}
/* Slide Content Wrapper */
.slide-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); /* Enhance text readability */
    background-color: rgba(0, 0, 0, 0.3); /* Slight overlay for contrast */
    padding: 20px;
    border-radius: 5px;
    max-width: 80%;
}
.slideshow-container .slide span.category-label {
    font-weight: 400; /* Lighter weight for label */
    display: block;
    font-size: 0.9em;
    margin-bottom: 8px;
    text-transform: uppercase;
    opacity: 0.9;
}
.slideshow-container .slide span.item-text {
    font-size: 1.4em; /* Larger text for prominence */
    font-weight: 700; /* Bold text */
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}
/* Slide Controls */
.slide-controls {
    position: absolute;
    top: 10px; right: 10px;
    display: flex; gap: 8px;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 5px 8px;
    border-radius: 4px;
    z-index: 5;
}
.slideshow-container .slide.active:hover .slide-controls {
    visibility: visible; /* Show on hover of active slide */
    opacity: 1;
}
.slide-controls button { background: none; border: none; color: #fff; font-size: 1rem; opacity: 0.8; }
.slide-controls button:hover { opacity: 1; }

/* Slide Navigation */
.slideshow-container .slide-nav {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px 12px;
    margin-top: -25px;
    color: #fff;
    font-weight: bold;
    font-size: 24px;
    transition: 0.3s ease;
    border-radius: 0 4px 4px 0; /* Rounded on one side */
    user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    z-index: 10; /* Above slides */
}
.slideshow-container .slide-nav.next { right: 0; border-radius: 4px 0 0 4px; }
.slideshow-container .slide-nav.prev { left: 0; border-radius: 0 4px 4px 0; }
.slideshow-container .slide-nav:hover { background-color: rgba(0, 0, 0, 0.5); }

/* -- Slide Themes -- */
/* Theme 1 */
.slide-theme-1 {
    background-image: linear-gradient(45deg, #2980b9, #6dd5fa);
}
/* Theme 2 */
.slide-theme-2 {
    background-image: linear-gradient(to right, #ff512f, #dd2476);
}
/* Theme 3 */
.slide-theme-3 {
    background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
    color: #3a1c1e; /* Darker text for light background */
    text-shadow: 1px 1px 2px rgba(255,255,255,0.3);
}
/* Theme 4 */
.slide-theme-4 {
    background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%);
}

/* --- View 4: Table --- */
.view-table.active { display: block; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 15px; border: 1px solid #dee2e6; border-radius: 4px; overflow: hidden; font-size: 0.95rem; }
.data-table th, .data-table td { border-bottom: 1px solid #dee2e6; padding: 12px 15px; text-align: left; vertical-align: middle; }
.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky; top: 0; /* Sticky header - requires container overflow */
    z-index: 1;
    white-space: nowrap;
}
.data-table td { background-color: #fff; }
.data-table tbody tr:nth-child(even) td { background-color: #fdfdff; }
.data-table tbody tr:hover td { background-color: #f1f3f5; }
.data-table td.item-text { white-space: normal; overflow-wrap: break-word; word-break: break-word; min-width: 150px; }
.data-table th[data-sortable] { cursor: pointer; user-select: none; }
.data-table th[data-sortable]:hover { background-color: #e9ecef; }
.data-table th .sort-icon { display: inline-block; width: 1em; text-align: center; margin-left: 5px; opacity: 0.4; transition: opacity 0.2s ease; color: #6c757d; }
.data-table th[data-sort-dir] .sort-icon { opacity: 1; color: #007bff; }
/* Icon content set by JS */
.data-table td:last-child { width: 90px; text-align: right; white-space: nowrap; }

/* --- Item Controls (Edit/Delete) --- */
.item-controls { display: flex; gap: 10px; margin-left: 10px; align-items: center; }
.item-controls button { background: none; border: none; color: #6c757d; cursor: pointer; font-size: 1rem; padding: 3px; line-height: 1; transition: color 0.2s ease; }
.item-controls button:hover { color: #007bff; }
.item-controls .delete-btn:hover { color: #dc3545; }
.item-controls button i { pointer-events: none; display: block; } /* Ensure icon doesn't block clicks */

/* --- Draggable items base style --- */
[draggable="true"] { user-select: none; }

/* --- Modals --- */
.modal {
    display: none;
    position: fixed; z-index: 1050; /* High z-index */
    left: 0; top: 0; width: 100%; height: 100%;
    overflow-x: hidden; overflow-y: auto; /* Allow modal scroll if content overflows */
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* Safari */
}
.modal.show { display: flex; align-items: center; justify-content: center; animation: fadeIn 0.3s ease-out; }
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 550px;
    position: relative;
    margin: 1.75rem auto; /* Allows scrolling */
    animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal .close-btn {
    position: absolute; top: 10px; right: 15px;
    color: #aaa; font-size: 30px; font-weight: bold;
    cursor: pointer; line-height: 1; padding: 5px;
    background: none; border: none;
}
.modal .close-btn:hover, .modal .close-btn:focus { color: #333; text-decoration: none; }
.modal h3 { margin-top: 0; margin-bottom: 25px; font-size: 1.3rem; }
.modal input[type="text"], .modal textarea { width: 100%; padding: 12px; margin-bottom: 20px; border: 1px solid #ced4da; border-radius: 4px; font-size: 1rem; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.modal input[type="text"]:focus, .modal textarea:focus { border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); }
.modal textarea { resize: vertical; min-height: 80px; }
.modal-actions { text-align: right; margin-top: 15px; display: flex; justify-content: flex-end; gap: 10px; }
/* Style for the new Next button in modal (initially hidden by JS) */
#modal-next-btn {
   /* Add specific styles if needed, currently inherits from .btn */
}

/* Prevent body scroll when modal is open */
body.modal-open { overflow: hidden; padding-right: var(--scrollbar-width, 0px); /* Compensate for scrollbar */ }

/* --- Guided Mode Sidebar --- */
#guided-sidebar {
    position: fixed;
    right: 0; top: 0;
    padding-top: 70px; /* Adjust based on final nav height */
    height: 100%; width: 300px; /* Wider */
    background-color: #f8f9fa;
    border-left: 1px solid #dee2e6;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 95; /* Below modals, above main */
    padding: 20px; padding-top: 80px; /* Ensure content below header */
    overflow-y: auto;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
}
#guided-sidebar.show { transform: translateX(0); }
#guided-sidebar h3 { margin-bottom: 20px; font-size: 1.15rem; color: #495057; }
#guided-sidebar ul { list-style: none; padding: 0; }
#guided-sidebar li { background-color: #fff; border: 1px solid #eee; padding: 12px 15px; margin-bottom: 10px; border-radius: 4px; cursor: pointer; font-size: 0.95rem; transition: background-color 0.2s, box-shadow 0.2s ease; }
#guided-sidebar li:hover { background-color: #e9ecef; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
#close-sidebar-btn { position: absolute; top: 70px; /* Align with content start */ right: 15px; background: none; border: none; font-size: 26px; color: #6c757d; cursor: pointer; line-height: 1; padding: 5px; }
#close-sidebar-btn:hover { color: #343a40; }

/* Sidebar State Body Classes */
body.sidebar-open-push main { margin-right: 300px; /* Push main content */ }
/* body.sidebar-open-overlay {} (No push, sidebar overlays) */


/* --- Responsiveness Adjustments --- */
/* Make controls stack under tabs on smaller screens */
@media (max-width: 992px) {
    .top-nav { flex-direction: column; align-items: stretch; }
    .tabs { order: 1; width: 100%; justify-content: flex-start; padding-bottom: 10px;} /* Ensure tabs take full width and scroll */
    .controls { order: 2; width: 100%; justify-content: space-between; flex-wrap: wrap; } /* Allow controls to wrap better */
    .mode-switch { order: 1; } /* Move mode switch first in controls row */
    .profile-menu-container { order: 2; } /* Profile menu last */

    /* Adjust sidebar behavior for overlay on smaller screens */
    body.sidebar-open-push main, body main { margin-right: 0 !important; } /* Override push effect */
    #guided-sidebar { z-index: 1060; } /* Ensure sidebar is above nav */
    body.sidebar-open-overlay::before { /* Dark overlay */
        content: '';
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background-color: rgba(0,0,0,0.4);
        z-index: 90; /* Below sidebar */
        transition: opacity 0.3s ease-in-out;
        opacity: 1;
    }
    body:not(.sidebar-open-overlay)::before { opacity: 0; pointer-events: none; }
}

/* Further adjustments for very small screens */
@media (max-width: 576px) {
    main, .tab-content { padding: 15px; }
    h2 { font-size: 1.4rem; }
    .tabs button.tab-link { font-size: 0.9rem; padding: 8px 10px; }
    .controls { gap: 8px; justify-content: center; } /* Center controls */
    .btn { font-size: 0.85rem; padding: 0.4rem 0.7rem; }
    .mode-switch label { padding: 0.4rem 0.5rem; }
    .item-card { flex-basis: 100%; } /* Stack cards */
    /* Grid columns adjust automatically based on minmax, but you might force single column */
     .view-columns.active {
         grid-template-columns: 1fr; /* Force single column */
     }
    #guided-sidebar { width: 85%; } /* Wider sidebar */
    .modal-content { padding: 20px; max-width: 95%; }
    .modal h3 { font-size: 1.1rem; margin-bottom: 20px; }
    .modal input[type="text"], .modal textarea { padding: 10px; font-size: 0.95rem; }
}

/* --- Expandable Tools Area --- */
/* Added actual styles for the expanded state */
.tools-section.expanded .tools-scroll {
    max-height: 350px; /* Allow more height */
    overflow-y: auto;  /* Add vertical scroll if needed */
    /* overflow-x: hidden; Prevent horizontal scroll when expanded? Optional */
}
.tools-section.expanded .tools-container {
    flex-wrap: wrap; /* Allow items to wrap onto multiple lines */
    min-width: auto; /* Override min-width when wrapped */
}
.expand-tools-btn {
   /* Styles for the expand button */
   display: none; /* Keep hidden by default, JS will show it if needed */
   margin: 10px auto 0; /* Center below the scroll area */
   padding: 5px 10px;
   font-size: 0.85rem;
   cursor: pointer;
   border: 1px solid #ccc;
   background-color: #f8f8f8;
   border-radius: 4px;
}
.expand-tools-btn:hover {
    background-color: #eee;
}