html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}

body {
    background-color: #1a1a2e;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
}
#page-content-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Ensures the wrapper fills the body's height (body is 100% height and flex column),
                     making it a stable container for sticky footer. */
}

.site-content {
    flex: 1 0 auto; /* Allows main content to grow and shrink, but not shrink below its content size */
    /* padding: 1em; Replaces main's padding */
}

.site-header {
    background-color: #2a2a3e;
    padding: 0.5em 1em; /* Adjusted padding */
    border-bottom: 1px solid #4f4f6a;
    position: sticky;
    top: 0;
    z-index: 1000; /* Ensure header stays on top */
    width: 100%;
    box-sizing: border-box;
}
/* Removed header h1 as it's replaced by .site-logo */

/* main padding is now on .site-content */
main {
    padding: 0px 16px 16px;
}

.filter-sort-container {
    padding: 0px 10px 10px 10px;
}

/* Filter and Sort Form Styles */
form.filter-sort-form {
    background-color: #2a2a3e;
    padding: .5em;
    border-radius: 8px;
    border: 1px solid #4f4f6a;
    margin-top: .5em;
    width: 100%;
    box-sizing: border-box;
}

.filter-sort-form .form-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5em;
    margin-bottom: 0.5em;
    align-items: center; /* Center items vertically if they wrap or for single line */
}

.filter-sort-form .form-row:last-child {
    margin-bottom: 0;
}

.filter-sort-form .form-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 140px; /* Consistent min-width */
    width: 100%; /* Ensure full width within flex container */
    box-sizing: border-box; /* Include padding and border in width calculation */
}

.filter-sort-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.filter-sort-form input[type="text"],
.filter-sort-form select {
    padding: 0.4em 0.6em; /* Further reduced padding */
    background-color: #1a1a2e;
    color: #7a7a8e;
    border: 1px solid #4f4f6a;
    border-radius: 4px;
    font-size: 0.8em; /* Further reduced font size */
    width: 100%;
    box-sizing: border-box;
    height: 30px; /* Set a fixed height for alignment */
    /* Prevent transitions on page load */
    transition: none;
}

.filter-sort-form input[type="text"]::placeholder {
    color: #7a7a8e; /* Slightly adjusted placeholder color */
}

/* Dark Theme Placeholder Styling for Select */
/* Styles the select box text when a placeholder (value="") is selected.
   Assumes a class 'select-placeholder-active' is added to the select element (e.g., via JavaScript)
   when its current value is "". */
.filter-sort-form select.select-placeholder-active {
    color: #7a7a8e; /* Match input placeholder color */
    font-style: italic; /* Make placeholder text italic */
    font-weight: 300; /* Make placeholder text lighter */
}

/* Styles the placeholder option (value="") within the dropdown list itself. */
.filter-sort-form select option[value=""] {
    color: #7a7a8e; /* Match input placeholder color */
    font-style: italic; /* Make placeholder text italic */
    font-weight: 300; /* Make placeholder text lighter */
}
/* Ensure non-placeholder options in the list retain their normal color. */
.filter-sort-form select option:not([value=""]) {
    color: #e0e0e0; /* Default dark theme option text color */
}
/* For select, the "All..." option text color is handled by browser/OS, difficult to style directly like placeholder */


.filter-sort-form input[type="text"]:focus,
.filter-sort-form select:focus {
    outline: none;
    border-color: #7a7af0;
    /* Prevent transitions on focus */
    transition: none;
}

.filter-sort-btn {
    background-color: #ff8c00;
    border: none;
    color: white;
    padding: 0 1em; /* Adjusted padding for height */
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 0.85em; /* Adjusted font size */
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    height: 30px; /* Match input/select height */
    line-height: 30px; /* Vertically center text */
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent button from shrinking */
    /* Remove any implicit transitions */
    transition: none;
}

.filter-sort-btn:hover {
    background-color: #e07b00;
    /* Ensure no transitions on hover */
    transition: none;
}


.card-grid {
    padding-top: 10px;
    display: grid;
    /* Adjust minmax for more compact cards, e.g., 200px or 180px */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1em;
}

.card-item {
    background-color: #2a2a3e;
    border: 1px solid #4f4f6a;
    border-radius: 10px; /* Increased from 8px */
    padding: 0; /* Removed padding for compactness */
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow 0.2s ease-in-out; /* Keep shadow, image zoom separate */
    overflow: hidden; /* To contain zoomed image if it exceeds bounds */
    justify-content: space-between;
}

.card-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.card-item:hover .card-image {
    transform: scale(1.05);
}

.card-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 10px; /* Increased from 8px */
    display: flex;
    align-items: center;    /* Vertical centering */
    justify-content: center; /* Horizontal centering */
    text-align: center;      /* Ensure alt text itself is centered if it wraps */
    min-height: 250px;
}

/* Styles for the image container within the card modal */
#modalCardImageContainer {
    position: relative; /* If any absolute positioning is needed for overlays inside */
    width: 100%; /* Or a specific max-width if desired for the modal image */
    overflow: hidden; /* To contain image or fallback text */
    display: flex;
    align-items: center;    /* Vertical centering for image or fallback text */
    justify-content: center; /* Horizontal centering for image or fallback text */
    text-align: center;      /* Ensure fallback text itself is centered if it wraps */
    min-height: 300px; /* Adjust as needed for modal context, can be same as .card-image-container or different */
    /* background-color: #222; */ /* Optional: for debugging or specific design */
    border-radius: 8px; /* Consistent with other modal elements if applicable */
    margin-bottom: 1em; /* Space below the image container */
}

/* Ensure the fallback text within the modal image container is also styled appropriately */
#modalCardImageContainer .broken-image-fallback-text {
    /* Styles for font-size, color, etc., are in .broken-image-fallback-text */
    /* This container provides the centering. */
    /* No specific overrides needed here unless layout within this container differs */
    max-width: 90%; /* Prevent very long card IDs from breaking layout */
}


.card-image {
    max-width: 100%;
    max-height: 100%; /* Ensure image respects container's height, esp. min-height */
    height: auto;
    border-radius: 10px; /* Increased from 8px */
    display: block;
    transition: transform 0.2s ease-in-out;
    object-fit: contain; /* Ensures the image aspect ratio is maintained */

    /* font-style and font-size for alt text removed */
}

.card-price-overlay {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: normal; /* Explicitly normal */
    z-index: 1;
}

.card-info {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0.5em;
    box-sizing: border-box; /* Ensure padding doesn't expand overall width for flex calculations */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.card-info h2 {
    font-size: 15px; /* Slightly smaller */
    font-weight: 550;
    margin-top: 0.15em; /* Reduced margin */
    margin-bottom: 0.2em; /* Reduced margin */
    color: #e0e0e0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%; /* Ensure it takes full width for ellipsis to work */
}

.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 0.25em;
}

.card-meta-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: 11px; /* Slightly smaller tags */
    color: #e0e0e0;
    gap: 0.3em; /* Reduced gap */
    flex-grow: 1;
    min-width: 0; /* Crucial for shrinking */
    flex-shrink: 1; /* Allow shrinking */
    overflow: hidden; /* Clip if absolutely necessary */
}

.card-meta-info span {
    background-color: #4f4f6a; /* Darker background for tags */
    padding: 0.2em 0.5em;
    border-radius: 4px; /* Rounded corners for tags */
    line-height: 1.3;
    display: inline-block; /* Allow padding and background */
}


.add-to-collection-btn {
    background-color: #ff8c00;
    border: none;
    color: white;
    width: 24px; /* More square and compact */
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-size: 1em; /* Adjusted font size */
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px; /* Square-ish */
    padding: 0;
    margin-left: 0.5em;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.add-to-collection-btn:hover {
    background-color: #e07b00; /* Darker orange on hover */
}

.site-footer-bottom {
    background-color: #2a2a3e;
    text-align: center;
    border-top: 1px solid #4f4f6a;
    font-size: 0.8em;
    flex-shrink: 0; /* Prevent footer from shrinking */
    width: 100%;
    box-sizing: border-box;
}

/* New Main Navigation Styles */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-group-left,
.nav-group-center,
.nav-group-right {
    display: flex;
    align-items: center;
    gap: 1em; /* Spacing between items in a group */
}

.nav-group-left {
    margin-right: auto; /* Pushes other groups to the right */
}

.nav-group-center {
    /* Centering can be tricky with flex if other elements vary in size.
       This group will be between left and right. */
}

.nav-group-center {
    flex-grow: 1; /* Allow center group to take up remaining space if needed */
    justify-content: center; /* Center items within this group if any */
}

.nav-group-right {
    margin-left: 0; /* Was auto, adjust for flex alignment */
    gap: 0.8em; /* Slightly reduced gap for compactness */
}

.site-logo {
    font-weight: bold;
    font-size: 1.5em;
    color: #e0e0e0;
    text-decoration: none;
}

.main-nav a,
.main-nav span, /* General styling for links and text in nav */
.nav-link-with-icon { /* Style for links that will contain an icon */
    color: #e0e0e0;
    text-decoration: none;
    font-size: 0.9em;
    display: inline-flex; /* Align icon and text */
    align-items: center;
    padding: 0.5em 0.8em; /* Consistent padding */
    border-radius: 4px; /* Consistent border-radius */
    line-height: 1.2; /* Consistent line-height */
    /* Remove transition to prevent flashing */
    transition: none;
}

.main-nav a:not(.nav-button):hover, /* Apply hover to non-button links */
.nav-link-with-icon:not(.active):hover { /* Apply hover to non-active icon links */
    color: #ff8c00; /* Simple text color change for non-button links */
    background-color: rgba(255, 140, 0, 0.05); /* Subtle hover background */
}

/* Active Navigation Link Styling - Dark Theme */
.main-nav a.active:not(.nav-button),
.nav-link-with-icon.active {
    background-color: #ff8c00; /* Orange background */
    color: white; /* White text */
    font-weight: bold;
    /* padding, border-radius, line-height are now in the base style */
    text-decoration: none; /* Ensure no underline */
}
/* Ensure icon color also reflects active state for dark theme */
.nav-link-with-icon.active .nav-icon {
    stroke: white; /* White icon */
}

.nav-button.active {
    background-color: white; /* White background */
    color: #ff8c00; /* Orange text */
    border: 1px solid #ff8c00; /* Orange border */
}
/* Ensure icon in active button also reflects active state */
.nav-button.active .nav-icon { /* If icons are used in nav-buttons */
    stroke: #ff8c00; /* Orange icon */
}


.nav-icon {
    width: 1em; /* Scale with font-size of parent */
    height: 1em;
    stroke: currentColor; /* Inherit color from parent link/button */
    fill: none; /* Typically for line icons */
    margin-right: 0.35em; /* Space between icon and text */
    vertical-align: middle; /* Helps alignment, though flex on parent is better */
}

/* For the theme toggle button, ensure the SVG inside scales well */
#theme-toggle svg {
    width: 1em; /* Match font size of button text if any, or set fixed */
    height: 1em;
    stroke: currentColor;
    fill: none;
    vertical-align: middle; /* Align icon within button */
}

/* Ensure links with icons align correctly */
.nav-link-with-icon {
    display: inline-flex;
    align-items: center;
}

/* Adjust theme toggle button padding if it only contains an icon */
.theme-toggle-button {
    padding: 0.6em; /* Adjust as needed */
    line-height: 1; /* Ensure icon is centered */
}

/* Welcome message styling */
.welcome-message {
    color: #e0e0e0;
    font-size: 0.9em;
    margin-right: 0.5em; /* Optional: space before logout button */
}

/* Light theme adjustments for icons and welcome message */
.light-theme .nav-icon {
    /* stroke: currentColor; ensures it inherits the light theme text color */
}
.light-theme #theme-toggle svg {
     /* stroke: currentColor; ensures it inherits the light theme button text color */
}
.light-theme .welcome-message {
    color: #333;
}

.nav-icon {
    width: 1em; /* Scale with font-size of parent */
    height: 1em;
    stroke: currentColor; /* Inherit color from parent link/button */
    fill: none; /* Typically for line icons */
    margin-right: 0.35em; /* Space between icon and text */
    vertical-align: middle; /* Helps alignment, though flex on parent is better */
}

/* For the theme toggle button, ensure the SVG inside scales well */
#theme-toggle svg {
    width: 1em; /* Match font size of button text if any, or set fixed */
    height: 1em;
    stroke: currentColor;
    fill: none;
}


/* New Button Styling */
.nav-button,
.nav-link-button, /* Keep existing class for logout button if needed, but style it as .nav-button */
#theme-toggle /* Style theme toggle as a nav-button */
{
    background-color: #ff8c00; /* Orange background */
    color: white; /* White text */
    padding: 0.47em 1em; /* Adjusted for 30px height */
    border: 1px solid #ff8c00; /* Border same as background for solid look */
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    /* Remove transition to prevent flashing */
    transition: none;
    display: inline-flex; /* For aligning text/icons if any */
    align-items: center;
    justify-content: center;
    line-height: 1; /* Ensure text is centered vertically */
    height: 30px; /* Standardized height */
    box-sizing: border-box; /* Include padding and border in height */
}

.nav-button:hover,
.nav-link-button:hover,
#theme-toggle:hover {
    background-color: white; /* White background on hover */
    color: #ff8c00; /* Orange text on hover */
    border-color: #ff8c00; /* Orange border on hover */
}

/* Specific for theme toggle if it needs different padding or size */
.theme-toggle-button {
    width: 30px; /* Make button square */
    padding: 0.47em; /* Adjusted for 30px height, makes it squarish */
    line-height: 1; /* Ensure icon is centered if button has fixed height due to padding */
}

/* Welcome message styling */
.welcome-message {
    color: #e0e0e0;
    font-size: 0.9em;
    margin-right: 0.5em; /* Optional: space before logout button */
}


/* Remove old .auth-nav and .auth-nav-links styles as they are restructured */
/* .auth-nav-links { ... } */
/* .auth-nav { ... } */
/* Ensure the logout form's button inherits .nav-button styles */
.main-nav form button.nav-button { /* More specific selector for logout button */
    /* Styles are inherited from .nav-button */
    /* No specific overrides needed unless it behaves differently */
}


/* Authentication Forms (Login, Register, Logged Out) */
.auth-container {
    max-width: 400px;
    margin: 2em auto;
    padding: 2em;
    background-color: #2a2a3e;
    border: 1px solid #4f4f6a;
    border-radius: 8px;
    text-align: center;
}

.auth-container h2 {
    color: #e0e0e0;
    margin-bottom: 1em;
}

.auth-form p {
    margin-bottom: 0.8em;
    color: #c0c0c0; /* Lighter text for form field labels */
    text-align: left;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"] {
    width: 100%;
    padding: 0.8em;
    margin-bottom: 1em;
    background-color: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #4f4f6a;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.9em;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="password"]:focus,
.auth-form input[type="email"]:focus {
    outline: none;
    border-color: #7a7af0;
}

.auth-form .btn,
.auth-container .btn { /* General button styling for auth pages */
    background-color: #ff8c00;
    border: none;
    color: white;
    padding: 0.8em 1.5em;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-top: 0.5em; /* Spacing for buttons */
}

.auth-form .btn:hover,
.auth-container .btn:hover {
    background-color: #e07b00;
}

.auth-container p {
    color: #c0c0c0;
    font-size: 0.9em;
}

.auth-container p a {
    color: #ff8c00;
    text-decoration: none;
}

.auth-container p a:hover {
    text-decoration: underline;
}

.error-message {
    color: #ff6b6b; /* A reddish color for errors */
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    padding: 0.8em;
    border-radius: 4px;
    margin-bottom: 1em;
    text-align: left;
}

/* Ensure base.html exists or these templates are self-contained for styling */
/* If using {% extends "cards/base.html" %}, ensure base.html includes:
   <link rel="stylesheet" href="{% static 'cards/css/main.css' %}">
   and a {% block content %}{% endblock %}
*/
/* My Collection Page Styles */
.my-collection-container {
    padding: 0px 16px 16px;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Slightly wider cards for collection view */
    gap: 1.5em; /* Increased gap for a bit more spacing */
}

.collection-card-item {
    background-color: #2a2a3e;
    border: 1px solid #4f4f6a;
    border-radius: 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Re-use .card-image-container and .card-image styles if they are suitable */
/* Or define specific ones if needed */

.collection-card-item .card-info { /* Assuming similar structure to all_cards_list */
    padding: 0.8em; /* Slightly more padding */
    text-align: left; /* Align text to left for collection details */
}

.collection-card-item .card-info h2 {
    font-size: 1.2em;
    margin-bottom: 0.3em;
    text-align: left;
}

.collection-card-item .card-info p {
    font-size: 0.9em;
    margin-bottom: 0.3em;
    color: #c0c0c0;
}

.collection-actions {
    margin-top: 0.8em;
    display: flex;
    gap: 0.5em;
}

.collection-actions .btn-disabled {
    background-color: #4f4f6a;
    color: #8a8a9e;
    padding: 0.4em 0.8em;
    border: none;
    border-radius: 4px;
    cursor: not-allowed;
    font-size: 0.8em;
}

/* Django Messages Styling */
.messages {
    list-style: none;
    padding: 0;
    margin-bottom: 1em;
}

.messages .alert { /* General alert styling */
    padding: 0.8em 1.2em;
    margin-bottom: 0.5em;
    border-radius: 4px;
    border: 1px solid transparent;
    text-align: center;
}

.messages .alert-success {
    color: #d4edda;
    background-color: #155724; /* Dark green background */
    border-color: #c3e6cb;
}

.messages .alert-info {
    color: #d1ecf1;
    background-color: #0c5460; /* Dark cyan background */
    border-color: #bee5eb;
}

.messages .alert-warning {
    color: #fff3cd;
    background-color: #856404; /* Dark yellow background */
    border-color: #ffeeba;
}

.messages .alert-error { /* Django uses 'error' tag for errors */
    color: #f8d7da;
    background-color: #721c24; /* Dark red background */
    border-color: #f5c6cb;
}
/* Styles for My Collection page forms */
.collection-actions .quantity-form,
.collection-actions .remove-form {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.collection-actions .quantity-input {
    width: 50px; /* Adjust width as needed */
    padding: 0.4em 0.6em;
    background-color: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #4f4f6a;
    border-radius: 4px;
    font-size: 0.9em;
    text-align: center;
}

.collection-actions .quantity-input:focus {
    outline: none;
    border-color: #7a7af0;
}

.collection-actions .btn { /* General button style for these forms */
    padding: 0.4em 0.8em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    transition: background-color 0.2s ease;
}

.collection-actions .btn-update {
    background-color: #007bff; /* Blue for update */
}

.collection-actions .btn-update:hover {
    background-color: #0056b3;
}

.collection-actions .btn-remove {
    background-color: #dc3545; /* Red for remove */
}

.collection-actions .btn-remove:hover {
    background-color: #c82333;
}

/* Light Theme Styles */
.light-theme body, body.light-theme {
    background-color: #f0f2f5; /* Light grey background */
    color: #333; /* Dark text */
    /* display: flex and flex-direction: column are inherited */
}

.light-theme .site-header, body.light-theme .site-header {
    background-color: #ffffff; /* White header */
    border-bottom: 1px solid #dee2e6; /* Light border */
    /* position: sticky, top, z-index, width, box-sizing are inherited */
}

.light-theme .main-nav a:hover:not(.nav-button),
body.light-theme .main-nav a:hover:not(.nav-button) {
    color: #007bff; /* Primary blue for link hover in light theme */
}

.light-theme .main-nav a:not(.nav-button):hover, /* Apply hover to non-button links */
.light-theme .nav-link-with-icon:not(.active):hover,
body.light-theme .main-nav a:not(.nav-button):hover,
body.light-theme .nav-link-with-icon:not(.active):hover {
    color: #007bff; /* Primary blue for link hover in light theme */
    background-color: rgba(0, 123, 255, 0.05); /* Subtle hover background */
}

/* Active Navigation Link Styling - Light Theme */
.light-theme .main-nav a.active:not(.nav-button),
.light-theme .nav-link-with-icon.active,
body.light-theme .main-nav a.active:not(.nav-button),
body.light-theme .nav-link-with-icon.active {
    background-color: #007bff; /* Blue background */
    color: white; /* White text */
    font-weight: bold;
    /* padding, border-radius, line-height are now in the base style */
    text-decoration: none; /* Ensure no underline */
}
/* Ensure icon color also reflects active state in light theme */
.light-theme .nav-link-with-icon.active .nav-icon,
body.light-theme .nav-link-with-icon.active .nav-icon {
    stroke: white; /* White icon */
}

.light-theme .nav-button.active,
body.light-theme .nav-button.active {
    background-color: #ff8c00; /* Orange background for active button in light theme */
    color: white; /* White text */
    border: 1px solid #e07b00; /* Darker orange border for definition */
}
/* Ensure icon in active light theme button also reflects active state */
.light-theme .nav-button.active .nav-icon,
body.light-theme .nav-button.active .nav-icon {
    stroke: white; /* White icon */
}


/* Icon color in light theme will also be currentColor, so it matches text unless overridden by active state */

.light-theme .nav-button,
.light-theme .nav-link-button,
.light-theme #theme-toggle,
body.light-theme .nav-button,
body.light-theme .nav-link-button,
body.light-theme #theme-toggle {
    background-color: #007bff; /* Blue background for buttons */
    color: white; /* White text */
    border-color: #007bff;
}

.light-theme .nav-button:hover,
.light-theme .nav-link-button:hover,
.light-theme #theme-toggle:hover,
body.light-theme .nav-button:hover,
body.light-theme .nav-link-button:hover,
body.light-theme #theme-toggle:hover {
    background-color: #e9ecef; /* Light grey background on hover */
    color: #007bff; /* Blue text on hover */
    border-color: #007bff; /* Blue border on hover */
}


.light-theme .site-content {
    /* flex: 1 0 auto; is inherited */
    /* padding: 1em; is inherited */
}

.light-theme .site-footer-bottom, body.light-theme .site-footer-bottom {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    color: #555;
    /* flex-shrink: 0; is inherited */
}

.light-theme .filter-sort-container, body.light-theme .filter-sort-container {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    /* border-top: none; Removed as it's now a distinct block */
    /* margin-top, width, box-sizing, border-radius inherited or overridden as needed */
}

.light-theme main > .filter-sort-container,
body.light-theme main > .filter-sort-container {
    /* Counteract main's padding if present, same as dark theme */
    margin-left: -1em;
    margin-right: -1em;
    width: calc(100% + 2em);
}


.light-theme .filter-sort-form input[type="text"],
.light-theme .filter-sort-form select,
body.light-theme .filter-sort-form input[type="text"],
body.light-theme .filter-sort-form select {
    background-color: #f8f9fa; /* Slightly off-white for inputs */
    color: #333;
    border: 1px solid #ced4da;
}

.light-theme .filter-sort-form input[type="text"]::placeholder,
body.light-theme .filter-sort-form input[type="text"]::placeholder {
    color: #6c757d; /* Grey placeholder */
}

/* Light Theme Placeholder Styling for Select */
.light-theme .filter-sort-form select.select-placeholder-active,
body.light-theme .filter-sort-form select.select-placeholder-active {
    color: #6c757d; /* Match input placeholder color */
    font-style: italic; /* Make placeholder text italic */
    font-weight: 300; /* Make placeholder text lighter */
}

.light-theme .filter-sort-form select option[value=""],
body.light-theme .filter-sort-form select option[value=""] {
    color: #6c757d; /* Match input placeholder color */
    font-style: italic; /* Make placeholder text italic */
    font-weight: 300; /* Make placeholder text lighter */
}

.light-theme .filter-sort-form select option:not([value=""]),
body.light-theme .filter-sort-form select option:not([value=""]) {
    color: #333; /* Default light theme option text color */
}

.light-theme .filter-sort-form input[type="text"]:focus,
.light-theme .filter-sort-form select:focus,
body.light-theme .filter-sort-form input[type="text"]:focus,
body.light-theme .filter-sort-form select:focus {
    border-color: #80bdff; /* Blue focus border */
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.light-theme .filter-sort-btn, body.light-theme .filter-sort-btn {
    background-color: #007bff; /* Blue primary button */
    color: white;
}

.light-theme .filter-sort-btn:hover, body.light-theme .filter-sort-btn:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

.light-theme .card-item, body.light-theme .card-item {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.light-theme .card-item:hover, body.light-theme .card-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}


.light-theme .card-price-overlay, body.light-theme .card-price-overlay {
    background-color: rgba(50, 50, 50, 0.7); /* Darker overlay for light theme */
    color: #fff;
}

.light-theme .card-info h2, body.light-theme .card-info h2 {
    color: #333;
}

.light-theme .card-meta-info, body.light-theme .card-meta-info {
    color: #555;
}

.light-theme .card-meta-info span, body.light-theme .card-meta-info span {
    background-color: #e9ecef; /* Light grey for tags */
    color: #495057; /* Darker text for tags */
    border: 1px solid #ced4da;
}

.light-theme .add-to-collection-btn, body.light-theme .add-to-collection-btn {
    background-color: #28a745; /* Green for add */
    color: white;
}

.light-theme .add-to-collection-btn:hover, body.light-theme .add-to-collection-btn:hover {
    background-color: #1e7e34; /* Darker green on hover */
}

.light-theme footer, body.light-theme footer {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    color: #555;
}

.light-theme .auth-nav-links a,
.light-theme .auth-nav-links span,
body.light-theme .auth-nav-links a,
body.light-theme .auth-nav-links span {
    color: #333;
    background-color: #e9ecef;
}

.light-theme .auth-nav-links a:hover, body.light-theme .auth-nav-links a:hover {
    background-color: #007bff;
    color: white;
}

.light-theme .welcome-message, body.light-theme .welcome-message {
    color: #333;
}

/* Old .auth-nav styles were here, removed as obsolete */
.light-theme .auth-container, body.light-theme .auth-container {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.075);
}

.light-theme .auth-container h2, body.light-theme .auth-container h2 {
    color: #333;
}

.light-theme .auth-form p, body.light-theme .auth-form p {
    color: #495057; /* Slightly darker than body text for labels */
}

.light-theme .auth-form input[type="text"],
.light-theme .auth-form input[type="password"],
.light-theme .auth-form input[type="email"],
body.light-theme .auth-form input[type="text"],
body.light-theme .auth-form input[type="password"],
body.light-theme .auth-form input[type="email"] {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ced4da;
}

.light-theme .auth-form input[type="text"]:focus,
.light-theme .auth-form input[type="password"]:focus,
.light-theme .auth-form input[type="email"]:focus,
body.light-theme .auth-form input[type="text"]:focus,
body.light-theme .auth-form input[type="password"]:focus,
body.light-theme .auth-form input[type="email"]:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.light-theme .auth-form .btn,
.light-theme .auth-container .btn,
body.light-theme .auth-form .btn,
body.light-theme .auth-container .btn {
    background-color: #007bff;
    color: white;
}

.light-theme .auth-form .btn:hover,
.light-theme .auth-container .btn:hover,
body.light-theme .auth-form .btn:hover,
body.light-theme .auth-container .btn:hover {
    background-color: #0056b3;
}

.light-theme .auth-container p, body.light-theme .auth-container p {
    color: #495057;
}

.light-theme .auth-container p a, body.light-theme .auth-container p a {
    color: #007bff;
}

.light-theme .auth-container p a:hover, body.light-theme .auth-container p a:hover {
    text-decoration: underline;
}

.light-theme .error-message, body.light-theme .error-message {
    color: #721c24; /* Dark red text */
    background-color: #f8d7da; /* Light red background */
    border: 1px solid #f5c6cb; /* Reddish border */
}

.light-theme .collection-card-item, body.light-theme .collection-card-item {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}

.light-theme .collection-card-item .card-info p, body.light-theme .collection-card-item .card-info p {
    color: #555;
}

.light-theme .collection-actions .btn-disabled, body.light-theme .collection-actions .btn-disabled {
    background-color: #e9ecef;
    color: #6c757d;
    border: 1px solid #ced4da;
}

/* Message Styling for Light Theme */
.light-theme .messages .alert-success, body.light-theme .messages .alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.light-theme .messages .alert-info, body.light-theme .messages .alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.light-theme .messages .alert-warning, body.light-theme .messages .alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.light-theme .messages .alert-error, body.light-theme .messages .alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.light-theme .collection-actions .quantity-input, body.light-theme .collection-actions .quantity-input {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ced4da;
}

.light-theme .collection-actions .quantity-input:focus, body.light-theme .collection-actions .quantity-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.light-theme .collection-actions .btn, body.light-theme .collection-actions .btn {
    /* General button style already covered by .auth-form .btn, if specific needed add here */
}

.light-theme .collection-actions .btn-update, body.light-theme .collection-actions .btn-update {
    background-color: #007bff; /* Blue for update */
}
.light-theme .collection-actions .btn-update:hover, body.light-theme .collection-actions .btn-update:hover {
    background-color: #0056b3;
}

.light-theme .collection-actions .btn-remove, body.light-theme .collection-actions .btn-remove {
    background-color: #dc3545; /* Red for remove */
}
.light-theme .collection-actions .btn-remove:hover, body.light-theme .collection-actions .btn-remove:hover {
    background-color: #c82333;
}

/*
    The old #theme-toggle and .nav-link-button specific styles are now
    covered by the new .nav-button styling and its light-theme overrides.
    These can be removed.
*/
/* Page Title Styles */
.page-title {
    font-size: 2em; /* Prominent but not overly large */
    font-weight: 600; /* Bold */
    margin-top: 1em; /* Adjust as needed */
    margin-bottom: 0.75em; /* Compact feel */
    color: var(--text-color); /* Inherits theme-aware color */
}
/* Main card container */
.card-item.collection-item { /* Be specific to collection items if needed */
  display: flex;
  flex-direction: column;
  border: 1px solid #4f4f6a;
  border-radius: 10px;
  background-color: #2a2a3e;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
}

.light-theme .card-item.collection-item {
  border: 1px solid #dee2e6;
  background-color: #ffffff;
}

.collection-item .card-info {
    gap: 5px;
    font-size: 0.85em;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow info to take available space */
}

/* Card title (name and ID) */
.collection-item .card-title {
  color: #ffffff;
  text-align: left;
}

/* Set/Type and Price row */
.collection-item .card-meta-price-row {
  display: grid;
  grid-template-columns: 1fr auto; /* Give more space to meta, auto to price */
  gap: 10px; /* Space between meta and price columns */
  margin-bottom: 0.75em; /* Adjust as needed */
  align-items: start;
}

/* Set and Type info */
.collection-item .card-meta-info {
  text-align: left;
  font-size: 0.9em; /* Adjust to match image */
}

/* Price information */
.collection-item .card-price-info {
  text-align: right;
  font-size: 0.9em; /* Adjust to match image */
}
.collection-item .card-price-info p {
  margin: 0 0 0.25em 0; /* Adjust spacing between "Each" and "Total" */
  color: #c0c0c0; /* Match existing p color in dark theme */
}
.light-theme .collection-item .card-price-info p {
  color: #555; /* Match existing p color in light theme */
}
.collection-item .card-price-info p:last-child {
  margin-bottom: 0;
}

/* Container for quantity controls and remove button */
.collection-item .card-actions-container {
  display: flex;
  flex-direction: column;
  gap: 0.75em; /* Space between quantity row and remove row */
  margin-top: auto; /* Push actions to the bottom if card-info is flex column */
}

/* Quantity row */
.collection-item .quantity-row {
  display: flex;
  align-items: center;
}

/* Remove row */
.collection-item .remove-row {
  display: flex;
  justify-content: flex-end; /* Align remove button to the right */
}

/* Quantity form */
.collection-item .quantity-form {
  display: flex;
  align-items: center;
  width: 100%;
}

/* Quantity label */
.collection-item .qty-label {
  margin-right: 0.5em;
  font-size: 0.9em; /* Adjust to match image */
  color: #c0c0c0; /* Match existing label color in dark theme */
}
.light-theme .collection-item .qty-label {
  color: #555; /* Match existing label color in light theme */
}

/* Price labels and values */
.collection-item .price-label {
  font-weight: normal;
  margin-right: 0.3em;
}

.collection-item .price-value {
  font-weight: bold;
  color: #e0e0e0; /* Match h2 color in dark theme */
}
.light-theme .collection-item .price-value {
  color: #333; /* Match h2 color in light theme */
}


/* Adjustments for quantity controls to match image */
.collection-item .quantity-control {
    display: flex;
    align-items: center;
}
.collection-item .quantity-btn {
    background-color: #4f4f6a;
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 1.1em;
    font-weight: bold;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.collection-item .quantity-btn:hover {
    background-color: #6a6a82;
}
.light-theme .collection-item .quantity-btn {
    background-color: #ced4da;
    color: #333;
}
.light-theme .collection-item .quantity-btn:hover {
    background-color: #adb5bd;
}

.collection-item .quantity-display {
    width: 40px;
    height: 28px;
    padding: 0.2em;
    text-align: center;
    font-size: 0.9em;
    border: 1px solid #4f4f6a;
    background-color: #1a1a2e;
    color: #e0e0e0;
    border-radius: 4px;
    margin: 0 5px;
}
.light-theme .collection-item .quantity-display {
    border: 1px solid #ced4da;
    background-color: #f8f9fa;
    color: #333;
}

.collection-item .btn-remove {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    width: 100%;
    justify-content: center;
}
.collection-item .btn-remove:hover {
    background-color: #c82333;
}
/* Collection Summary Styles */
.collection-summary {
    background-color: #2a2a3e; /* Dark theme background */
    border: 1px solid #4f4f6a; /* Dark theme border */
    border-radius: 8px;
    padding: 4px;
    color: #e0e0e0; /* Dark theme text color */
}

.collection-summary h2 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 0.75em;
    color: #e0e0e0; /* Dark theme heading color */
    border-bottom: 1px solid #4f4f6a; /* Separator for heading */
    padding-bottom: 0.5em;
}

.collection-summary .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4em 0;
    font-size: 0.95em;
    border-bottom: 1px dashed #404058; /* Lighter, dashed separator for items */
}

.collection-summary .summary-item:last-child {
    border-bottom: none;
}

.collection-summary .summary-label {
    font-weight: 500;
    color: #c0c0d0; /* Slightly lighter label color */
}

.collection-summary .summary-value {
    font-weight: bold;
    color: #e0e0e0;
}

.collection-summary .card-types-summary ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    text-align: right; /* Align list items to the right with the value */
}

.collection-summary .card-types-summary li {
    font-size: 0.9em;
    color: #c0c0d0; /* Match label color for consistency */
}
.collection-summary .card-types-summary .summary-label {
    align-self: flex-start; /* Align "Card Types:" label to the top if list is long */
}


/* Light Theme for Collection Summary */
.light-theme .collection-summary, body.light-theme .collection-summary {
    background-color: #ffffff; /* Light theme background */
    border: 1px solid #dee2e6; /* Light theme border */
    color: #333; /* Light theme text color */
}

.light-theme .collection-summary h2, body.light-theme .collection-summary h2 {
    color: #333; /* Light theme heading color */
    border-bottom: 1px solid #dee2e6; /* Light theme separator */
}

.light-theme .collection-summary .summary-item, body.light-theme .collection-summary .summary-item {
    border-bottom: 1px dashed #e0e0e0; /* Lighter separator for light theme */
}

.light-theme .collection-summary .summary-item:last-child, body.light-theme .collection-summary .summary-item:last-child {
    border-bottom: none;
}

.light-theme .collection-summary .summary-label, body.light-theme .collection-summary .summary-label {
    color: #555; /* Light theme label color */
}

.light-theme .collection-summary .summary-value, body.light-theme .collection-summary .summary-value {
    color: #333; /* Light theme value color */
}

.light-theme .collection-summary .card-types-summary li, body.light-theme .collection-summary .card-types-summary li {
    color: #555; /* Match label color for consistency */
}
/* Summary Panel Styles */

.summary-panel-hidden {
    transform: translateX(-100%);
}

.toggle-summary-btn {
    background-color: #ff8c00;
    color: white;
    border: none;
    padding: 0.5em 1em;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-bottom: 1em; /* Space between button and summary content */
    display: block; /* Make it a block to position easily */
}

.toggle-summary-btn:hover {
    background-color: #e07b00;
}

/* Light Theme for Summary Panel */
.light-theme .summary-panel, body.light-theme .summary-panel {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-left: none;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.light-theme .toggle-summary-btn, body.light-theme .toggle-summary-btn {
    background-color: #007bff;
}

.light-theme .toggle-summary-btn:hover, body.light-theme .toggle-summary-btn:hover {
    background-color: #0056b3;
}

/* Adjust main content padding if summary panel is fixed and overlaps */
.my-collection-container.summary-panel-visible {
    /* Example: Add padding to the left if summary panel is on the left */
    /* padding-left: 320px; /* summary panel width + some margin */
    /* This might be better handled with JS by adding a class to the body or main container */
}
/* === My Collection Page Enhancements === */

/* --- Collection Summary (Sticky Footer) --- */
.summary-panel-sticky {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 10px;
}

.collection-summary-horizontal {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: space-evenly; /* Distribute items evenly */
    align-items: center;
}

.collection-summary-horizontal .summary-item {
    display: flex;
    flex-direction: row; /* Align label and value horizontally */
    align-items: center;
    gap: 0.5em; /* Space between label and value */
    padding: 0.3em 0; /* Reduced padding */
    border-bottom: none; /* Remove individual item borders */
    font-size: 12px;
}

.collection-summary-horizontal .summary-label {
    font-weight: normal;
    color: #c0c0d0;
}

.collection-summary-horizontal .summary-value {
    font-weight: bold;
    color: #e0e0e0;
}

.collection-summary-horizontal .summary-tag {
    background-color: #4f4f6a; /* Tag background for dark theme */
    color: #e0e0e0;
    padding: 0.3em 0.6em;
    border-radius: 4px;
    font-size: 0.9em;
    line-height: 1.3;
}

.collection-summary-horizontal .card-types-summary {
    display: flex; /* Keep as flex for label + div structure */
    align-items: center;
}

.collection-summary-horizontal .card-types-summary .summary-value {
    display: flex; /* Make the inner div flex for multiple type:count pairs */
    flex-wrap: wrap;
    gap: 0.5em; /* Gap between type:count pairs */
    background-color: transparent; /* Override if it inherits .summary-tag directly */
    padding: 0; /* Override if it inherits .summary-tag directly */
}

.collection-summary-horizontal .card-types-summary .summary-value span {
    background-color: #4f4f6a; /* Tag background for individual type:count */
    color: #e0e0e0;
    padding: 0.2em 0.5em;
    border-radius: 3px;
    font-size: 0.85em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Light Theme for Sticky Summary */
.light-theme .summary-panel-sticky, body.light-theme .summary-panel-sticky {
    position: sticky; /* Add sticky properties */
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;     /* Add sticky properties */
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 10px; /* Add consistent padding */
    box-sizing: border-box; /* Add box-sizing */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.07);
}

.light-theme .collection-summary-horizontal .summary-label, body.light-theme .collection-summary-horizontal .summary-label {
    color: #555;
}

.light-theme .collection-summary-horizontal .summary-value, body.light-theme .collection-summary-horizontal .summary-value {
    color: #333;
}

.light-theme .collection-summary-horizontal .summary-tag, body.light-theme .collection-summary-horizontal .summary-tag {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

.light-theme .collection-summary-horizontal .card-types-summary .summary-value span,
body.light-theme .collection-summary-horizontal .card-types-summary .summary-value span {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}


/* --- Individual Card Display Enhancements (My Collection) --- */
.collection-item .collection-details {
    font-size: 0.8em; /* Further condense */
    margin-top: 0.3em;
    margin-bottom: 0.4em;
}
.collection-item .collection-details p {
    margin: 0.1em 0;
    display: flex; /* Align label and value */
    justify-content: space-between; /* Push value to the right */
}
.collection-item .collection-details .detail-label {
    font-weight: normal;
    color: #c0c0c0; /* Dark theme */
    margin-right: 0.3em;
}
.light-theme .collection-item .collection-details .detail-label {
    color: #555; /* Light theme */
}

/* Quantity Adjustment Buttons */
.collection-item .quantity-form {
    display: flex;
    align-items: center;
    gap: 0.3em; /* Reduced gap */
    width: 100%; /* Ensure form takes full width in its column */
}

.btn-quantity {
    background-color: #4f4f6a; /* Dark theme default */
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px; /* Fixed width */
    height: 28px; /* Fixed height */
    font-size: 1.1em; /* Make + / - slightly larger */
    font-weight: bold;
    line-height: 26px; /* Adjust for vertical centering */
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

.btn-quantity:hover {
    background-color: #6a6a82; /* Dark theme hover */
}

.light-theme .btn-quantity {
    background-color: #ced4da; /* Light theme default */
    color: #333;
}
.light-theme .btn-quantity:hover {
    background-color: #adb5bd; /* Light theme hover */
}

.quantity-input-compact {
    width: 40px; /* Minimal width for 2 digits */
    height: 28px;
    padding: 0.2em;
    text-align: center;
    font-size: 0.9em;
    border: 1px solid #4f4f6a; /* Dark theme */
    background-color: #1a1a2e; /* Dark theme */
    color: #e0e0e0; /* Dark theme */
    border-radius: 4px;
    -moz-appearance: textfield; /* Firefox */
    flex-grow: 0; /* Don't grow */
    flex-shrink: 0; /* Don't shrink */
}

.quantity-input-compact::-webkit-outer-spin-button,
.quantity-input-compact::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.light-theme .quantity-input-compact {
    border: 1px solid #ced4da; /* Light theme */
    background-color: #f8f9fa; /* Light theme */
    color: #333; /* Light theme */
}

/* Remove Button Styling */
.collection-item .btn-remove-danger {
    background-color: #dc3545; /* Red */
    color: white;
    border: none;
    padding: 0; /* Removed padding for icon-only */
    font-size: 0; /* Hide button text */
    border-radius: 8px; /* More rounded borders */
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Center icon */
    width: 40px; /* Fixed width for icon button */
    height: 20px; /* Fixed height for icon button */
    gap: 0; /* No gap needed for icon-only */
}

.collection-item .btn-remove-danger:hover {
    background-color: #c82333; /* Darker red */
}

.collection-item .btn-remove-danger .fas { /* Font Awesome icon */
    font-size: 12px; /* Use absolute size for icon visibility */
    line-height: 1; /* Ensure icon is centered if it has line-height issues */
}

.light-theme .collection-item .btn-remove-danger {
    /* Red is universal for danger, no specific light theme override unless desired */
}

/* --- My Collection Card Item Layout --- */
.collection-item .card-info {
    padding: 0.75em; /* Consistent padding for card info area */
}

.collection-item .card-name-row .card-title {
    font-size: 15px; /* Adjust as needed */
    font-weight: 550;
    margin: 0;
    text-align: left; /* Ensure card title is left-aligned */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-item .card-meta-data-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top of the row */
    gap: 0.5em; /* Space between left and right columns */
}

.collection-item .meta-left-column {
    flex-grow: 1; /* Allow left column to take available space */
    min-width: 0; /* Prevent overflow issues with flex items */
}

.collection-item .card-tags span {
    background-color: #4f4f6a;
    color: #e0e0e0;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
    display: inline-block;
    white-space: nowrap; /* Prevent wrapping for short tags */
}

.light-theme .collection-item .card-tags span {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}
/* Styles for individual card tags in My Collection */
.collection-item .card-tag-item {
    display: block;
    background-color: #4f4f6a; /* Copied from .collection-item .card-tags span */
    color: #e0e0e0; /* Copied from .collection-item .card-tags span */
    padding: 0.2em 0.5em; /* Copied from .collection-item .card-tags span */
    border-radius: 4px; /* Copied from .collection-item .card-tags span */
    font-size: 0.8em; /* Copied from .collection-item .card-tags span */
    line-height: 1.3; /* Copied from .collection-item .card-tags span */
    margin-bottom: 0.3em; /* Added spacing */
    white-space: nowrap; /* Copied from .collection-item .card-tags span */
    text-align: center; /* Center text within the tag */
}

.collection-item .card-tag-item:last-child {
    margin-bottom: 0; /* Remove margin from the last item for cleaner look */
}

.light-theme .collection-item .card-tag-item {
    background-color: #e9ecef; /* Copied from .light-theme .collection-item .card-tags span */
    color: #495057; /* Copied from .light-theme .collection-item .card-tags span */
    border: 1px solid #ced4da; /* Copied from .light-theme .collection-item .card-tags span */
    /* Other properties like padding, border-radius, font-size, line-height, margin-bottom, white-space are inherited or consistent */
}

.collection-item .meta-right-column {
    flex-shrink: 0; /* Prevent right column from shrinking too much */
    text-align: right;
}

.collection-item .market-data {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align items to the right if they are block */
}

.collection-item .market-data p {
    margin: 0 0 0.15em 0; /* Small space between price lines */
    font-size: 0.85em;
    line-height: 1.2;
}
.collection-item .market-data p:last-child {
    margin-bottom: 0;
}

.collection-item .market-data .price-label {
    color: #c0c0c0; /* Dark theme */
}
.light-theme .collection-item .market-data .price-label {
    color: #555; /* Light theme */
}
.collection-item .market-data .price-value {
    font-weight: bold;
}


.collection-item .card-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ensure collection actions are stacked and take full width - This might be from an older structure */
/* .collection-item .collection-actions {
    flex-direction: column;
    gap: 0.5em;
} */

/* Override general .collection-actions .btn if needed for +/- buttons */
/* .collection-item .collection-actions .quantity-form .btn {
} */

input:focus,
textarea:focus,
select:focus {
  border-color: #ff9900; /* Orange border on focus */
  box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.3); /* Subtle orange glow on focus */
  outline: none; /* Optional: remove default browser outline if it clashes */
  /* Prevent transitions on focus */
  transition: none !important;
}
/* Styles for compact quantity control in My Collection */
/* These styles are mostly fine, but ensure they fit the new .card-actions-row flex layout */
.my-collection-container .quantity-control-compact {
    display: flex;
    align-items: center;
    font-size: 0.85em; /* Base font size from .card-info for relative units below */
}

.my-collection-container .quantity-control-compact .qty-label {
    margin-right: 4px;
    font-size: 0.95em; /* Relative to .quantity-control-compact's font-size */
    color: #a0a0a0;
}
.light-theme .my-collection-container .quantity-control-compact .qty-label {
    color: #555;
}


.my-collection-container .quantity-btn-compact {
    background-color: #4a4a70; /* Dark theme */
    color: #ffffff;
    border: none;
    padding: 3px 6px; /* Keep compact */
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    line-height: 1;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}
.my-collection-container .quantity-btn-compact:hover {
    background-color: #5a5a80; /* Dark theme */
}
.light-theme .my-collection-container .quantity-btn-compact {
    background-color: #ced4da; /* Light theme */
    color: #333;
}
.light-theme .my-collection-container .quantity-btn-compact:hover {
    background-color: #adb5bd; /* Light theme */
}


.my-collection-container .quantity-display-compact {
    width: 26px; /* Keep compact */
    text-align: center;
    font-size: 0.9em;
    padding: 3px 0; /* Keep compact */
    background-color: #3b3b63; /* Dark theme */
    color: #e0e0e0;
    border: 1px solid #4a4a70; /* Dark theme */
    border-radius: 3px;
    -moz-appearance: textfield; /* Firefox */
}
.light-theme .my-collection-container .quantity-display-compact {
    background-color: #f8f9fa; /* Light theme */
    color: #333;
    border: 1px solid #ced4da; /* Light theme */
}

.my-collection-container .quantity-display-compact::-webkit-outer-spin-button,
.my-collection-container .quantity-display-compact::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Scoped quantity-form for My Collection page */
.my-collection-container .quantity-form { /* This is the form inside quantity-control-compact */
    display: flex;
    align-items: center;
}

/* Ensure the remove button container in actions row aligns to the right */
.collection-item .remove-button-container {
    display: flex;
    justify-content: flex-end;
}

a.add-to-collection-btn {
    text-decoration: unset;
}
/* Styles for Multi-Select Feature */
.multi-selected-card {
    border: 2px solid green;
    box-shadow: 0 0 5px green;
    transition: none; /* Ensure glow appears instantly */
}
/*
--- Theme-Specific Styles for Multi-Select Toggle Button ---
*/

/* Default (Dark Theme) for #toggle-multi-select-btn */
/* Leverages .btn .btn-sm .btn-outline-secondary for base structure */
#toggle-multi-select-btn {
    background-color: #ff8c00;
    color: white;
    border-radius: 8px;
    padding: 0.4em 0.8em;
    font-size: 10px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: none;
}

#toggle-multi-select-btn:hover {
    color: #ffffff;
    background-color: #4f4f6a; /* Use border color as hover background */
    border-color: #64648c; /* Slightly lighter border on hover */
}

#toggle-multi-select-btn:focus,
#toggle-multi-select-btn.focus { /* .focus class for Bootstrap 4 compatibility */
    color: #ffffff;
    background-color: #4f4f6a;
    border-color: #7a7af0; /* Consistent with dark theme input focus */
    box-shadow: 0 0 0 0.2rem rgba(122, 122, 240, 0.25); /* Focus glow */
}

#toggle-multi-select-btn:active,
#toggle-multi-select-btn.active {
    color: #ffffff;
    background-color: #3e3e5a; /* Darker shade of the hover/border color */
    border-color: #7a7af0; /* Keep focus border color for active state */
}


/* Light Theme for #toggle-multi-select-btn */
body.light-theme #toggle-multi-select-btn {
    color: #495057; /* Standard dark grey text for light theme, good contrast */
    border-color: #ced4da; /* Standard light theme input/ui border */
    background-color: transparent;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

body.light-theme #toggle-multi-select-btn:hover {
    color: #ffffff;
    background-color: #6c757d; /* Bootstrap's secondary color, good for hover */
    border-color: #5a6268; /* Darker shade of the hover background */
}

body.light-theme #toggle-multi-select-btn:focus,
body.light-theme #toggle-multi-select-btn.focus {
    color: #ffffff;
    background-color: #6c757d;
    border-color: #80bdff; /* Consistent with light theme input focus */
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); /* Focus glow */
}

body.light-theme #toggle-multi-select-btn:active,
body.light-theme #toggle-multi-select-btn.active {
    color: #ffffff;
    background-color: #545b62; /* Darker shade of the hover/secondary color */
    border-color: #80bdff; /* Keep focus border color for active state */
}
/* Styles for JavaScript-generated fallback text for broken images */
.broken-image-fallback-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 25px;
    font-weight: bolder;
    color: #a0a0a0; /* Fallback text color for dark theme */
    padding: 10px; /* Removed padding to prevent height increase */
    /* Centering is handled by .card-image-container */
}

.light-theme .broken-image-fallback-text {
    color: #6c757d; /* Fallback text color for light theme */
}

/* Collection Actions Container */
div#collection-actions-container {
    background-color: #2a2a3e;
    padding: 5px;
    border: 1px solid #4f4f6a;
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    width: fit-content;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0px 10px;
    gap: 10px;
    margin-left: 45%;
}

button#new-action-btn {
    background-color: #ff8c00;
    color: white;
    border-radius: 8px;
    padding: 0.4em 0.8em;
    font-size: 10px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: none;
}
/* Release Set Collection Actions Panel */
#release_set_collection_actions {
    background-color: #2a2a3e;
    padding: 5px;
    border: 1px solid #4f4f6a;
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    width: fit-content;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0px 10px;
    margin-left: 40%;
    gap: 10px;
}

/* Light Theme for Release Set Collection Actions Panel */
.light-theme #release_set_collection_actions,
body.light-theme #release_set_collection_actions {
    background-color: #ffffff; /* Matches light theme .collection-summary background */
    border-color: #dee2e6; /* Matches light theme .collection-summary border color */
    /* border-bottom: none; is inherited from the more specific ID selector rule above */
}

button#export-displayed-card-ids-btn {
    background-color: #ff8c00;
    color: white;
    border-radius: 8px;
    padding: 0.4em 0.8em;
    font-size: 10px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: none;
}

button#export-needed-cards-btn {
    background-color: #ff8c00;
    color: white;
    border-radius: 8px;
    padding: 0.4em 0.8em;
    font-size: 10px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: none;
}

button#display-needed-cards-btn {
    background-color: #ff8c00;
    color: white;
    border-radius: 8px;
    padding: 0.4em 0.8em;
    font-size: 10px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: none;
}

p.needed-quantity-text {
    margin: unset;
}
/* Styles for Needed Cards Display */
.card-needed-quantity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5em;
}

.needed-card-item .add-to-collection-btn {
    background-color: #28a745; /* Green for add */
    color: white;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5em;
    flex-shrink: 0;
    text-decoration: none;
}

.needed-card-item .add-to-collection-btn:hover {
    background-color: #1e7e34; /* Darker green on hover */
}

.light-theme .needed-card-item .add-to-collection-btn {
    background-color: #28a745;
}

.light-theme .needed-card-item .add-to-collection-btn:hover {
    background-color: #1e7e34;
}