body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow: hidden; /* Prevent scrollbars */
}

canvas {
    background-color: #111827; /* Dark background */
    display: block; /* Removes extra space below canvas */
    width: 100vw;
    height: 100vh;
}

.toggle-menu-button {
    position: absolute;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    background-color: #575757;
    color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 0 5px #4a4a4a;
    border: 2px solid #4e4e4e;
    left: 10px;
}

.toggle-menu-button:hover {
    background-color: #30353e; /* Darker blue */
}

#toggle-names-button {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10; /* Ensure button is above the canvas */
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    background-color: #3b82f6; /* Blue */
    color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 0 5px #fff;
    border: 2px solid #fff;
}

#toggle-names-button:hover {
    background-color: #2563eb; /* Darker blue */
}

/* Add these styles for the DataTable */
#rental-fleet-table.dataTable td.dt-center,
#rental-fleet-table.dataTable th.dt-center {
    text-align: center;
}

#rental-fleet-table.dataTable td ul {
    padding: 0;
    margin: 0;
    list-style-type: none;
    text-align: left; /* Align list items to the left within the centered cell */
}

#rental-fleet-table.dataTable td ul li {
    margin-bottom: 5px; /* Add some spacing between list items */
}

#user-info-popup {
    position: fixed; /* Keeps it in place even when scrolling */
    top: 100px;       /* Distance from the top edge of the viewport */
    right: 20px;     /* Distance from the right edge of the viewport */
    background-color: rgba(30, 30, 30, 0.9); /* Dark, slightly transparent background */
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); /* Soft shadow for depth */
    z-index: 1000;   /* Ensure it's above other elements */
    max-width: 350px; /* Limit width */
    text-align: left;
    font-size: 0.95em;
    line-height: 1.5;

    /* Initial state (hidden) */
    transform: translateX(120%); /* Start completely off-screen to the right */
    opacity: 0;
    pointer-events: none; /* Prevents interaction when hidden */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out; /* Smooth animation */
}

#welcome-info-content {
    /* Positioning */
    position: fixed;
    top: 50%; /* Move the top edge to the middle of the screen */
    left: 50%; /* Move the left edge to the middle of the screen */
    transform: translate(-50%, -50%); /* Shift the element back by half its own width and height */
    z-index: 2000; /* Ensure it's on top of all other content */

    /* Appearance */
    background-color: #2c3e50; /* A dark, clean background */
    color: #ecf0f1;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid #4a637e;
    width: 90%;
    max-width: 500px; /* Set a max-width for larger screens */

    /* Transition for smooth show/hide effects */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* State when visible */
#user-info-popup.user-info-visible {
    transform: translateX(0); /* Slide into view */
    opacity: 1;
    pointer-events: auto; /* Allows interaction when visible */
}

.user-info-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto; /* Allows interaction when visible */
}

/* State when hidden */
.user-info-hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    pointer-events: none; /* Prevents interaction when hidden */
}

#user-info-popup.user-info-hidden {
    transform: translateX(120%); /* Slide out of view */
    opacity: 0;
    pointer-events: none;
}

#user-info-popup p {
    margin: 5px 0; /* Adjust vertical spacing for text inside */
}

#user-info-popup p:first-child {
    margin-top: 0;
}

#user-info-popup p:last-child {
    margin-bottom: 0;
}

#user-info-popup strong {
    color: #00BFFF; /* A distinct color for strong text */
}

/* Styles for the close button */
.close-popup-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 1.5em; /* Larger 'x' */
    color: #aaa; /* Lighter color */
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1; /* For vertical alignment */
    padding: 0;
}

.close-popup-btn:hover {
    color: white; /* White on hover */
}
/* --- User Panel Modal Styles --- */
#user-panel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Dim background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Higher than other popups */

    /* Initial hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#user-panel-modal.user-panel-visible {
    opacity: 1;
    pointer-events: auto;
}

#user-panel-modal.user-panel-hidden {
    opacity: 0;
    pointer-events: none;
}

.user-panel-content {
    background-color: #222; /* Darker background for the panel */
    color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.8);
    width: 90%;
    max-width: 500px; /* Max width for larger screens */
    max-height: 90vh; /* Max height to allow scrolling */
    overflow-y: auto; /* Enable scrolling if content overflows */
    position: relative; /* For close button positioning */
    transform: translateY(-20px); /* Initial slightly off-center for animation */
    transition: transform 0.3s ease-in-out;
}

#user-panel-modal.user-panel-visible .user-panel-content {
    transform: translateY(0); /* Slide into center */
}

.user-panel-content h2,
.user-panel-content h3 {
    color: #00BFFF; /* Bright blue for headings */
    margin-top: 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid #444; /* Subtle separator */
    padding-bottom: 5px;
}

.user-panel-content p {
    margin-bottom: 10px;
}

.user-panel-content input[type="text"] {
    width: calc(100% - 20px); /* Adjust width for padding */
    padding: 10px;
    margin-bottom: 15px;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 5px;
    color: white;
}

.user-panel-content button {
    padding: 10px 20px;
    background-color: #4CAF50; /* Green save button */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.user-panel-content button:hover {
    background-color: #45a049;
}

#panelMessage {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    display: none; /* Hidden by default */
}
#panelMessage.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
#panelMessage.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.panel-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em; /* Larger 'x' */
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}
.panel-close-btn:hover {
    color: white;
}

/* --- Profile Selector Modal Styles --- */
#profile-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Slightly darker, more opaque background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Highest z-index for critical popups */

    /* Initial hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother fade in/out */
}

#profile-selector-modal.profile-selector-visible {
    opacity: 1;
    pointer-events: auto;
}

#profile-selector-modal.profile-selector-hidden {
    opacity: 0;
    pointer-events: none;
}

.profile-selector-content {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a); /* Subtle gradient background */
    color: #e0e0e0; /* Softer white text */
    padding: 35px 30px; /* Increased padding */
    border-radius: 15px; /* More rounded corners */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7); /* Stronger, diffused shadow */
    width: 90%;
    max-width: 500px; /* Slightly wider max-width */
    max-height: 85vh; /* Allow more vertical space */
    overflow-y: auto;
    position: relative;
    transform: translateY(-20px) scale(0.95); /* Start slightly higher and smaller */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother slide/scale */
    border: 1px solid #333; /* Subtle border */
}

#profile-selector-modal.profile-selector-visible .profile-selector-content {
    transform: translateY(0) scale(1); /* Slide into center and full size */
}

.profile-selector-content h2 {
    font-size: 1.8em; /* Larger heading */
    color: #8fbc8f; /* Soft green heading for a modern feel */
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3); /* Subtle text shadow */
    font-family: 'Inter', sans-serif; /* Consistent font */
}

.profile-selector-content p {
    text-align: center;
    margin-bottom: 25px; /* Increased margin */
    font-size: 1.1em;
    color: #b0b0b0; /* Lighter grey for descriptive text */
    font-family: 'Inter', sans-serif; /* Consistent font */
}

#profileList {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #4a4a4a; /* Darker border for the list */
    border-radius: 10px; /* Rounded list container */
    max-height: 250px; /* Slightly taller list */
    overflow-y: auto;
    background-color: #333; /* Slightly darker list background */
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.4); /* Inner shadow for depth */
}

#profileList li {
    padding: 15px 20px; /* More padding for items */
    border-bottom: 1px solid #4a4a4a;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    font-family: 'Inter', sans-serif; /* Consistent font */
    word-break: break-all; /* Ensure long IDs wrap */
    overflow-wrap: break-word; /* For better wrapping */
}

#profileList li:last-child {
    border-bottom: none;
}

#profileList li:hover {
    background-color: #555;
    color: #fff;
    transform: translateX(5px); /* Slight slide effect on hover */
}

#profileList li.selected {
    background: linear-gradient(90deg, #1e90ff, #007bff); /* Blue gradient for selected */
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4); /* Blue glow effect */
    border-radius: 5px; /* Inner rounded corners for selected item */
    transform: scale(1.02); /* Slight scale up on selection */
}

#profileList li.selected:hover {
    background: linear-gradient(90deg, #0069d9, #1e90ff); /* Darker blue on hover */
    transform: scale(1.02) translateX(3px); /* Maintain scale, slight slide */
}

.profile-selector-content button {
    display: block;
    width: 50%; /* Slightly smaller width */
    margin: 30px auto 0; /* More margin from list */
    padding: 15px 25px; /* More padding */
    background: linear-gradient(45deg, #007bff, #0056b3); /* Blue gradient for button */
    color: white;
    border: none;
    border-radius: 8px; /* More rounded button */
    font-size: 1.2em; /* Larger font */
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4); /* Blue button shadow */
    font-family: 'Inter', sans-serif; /* Consistent font */
}

.profile-selector-content button:hover {
    background: linear-gradient(45deg, #0056b3, #007bff); /* Reverse gradient on hover */
    transform: translateY(-2px); /* Slight lift effect */
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.6); /* More intense shadow on hover */
}

.selector-close-btn {
    position: absolute;
    top: 15px; /* Adjusted position */
    right: 18px; /* Adjusted position */
    background: none;
    border: none;
    font-size: 2.5em; /* Larger 'x' for better clickability */
    color: #999; /* Softer grey */
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1; /* Better vertical alignment */
}
.selector-close-btn:hover {
    color: #fff; /* White on hover */
    transform: rotate(90deg); /* Spin effect on hover */
}

#profileSelectorMessage {
    margin-top: 20px; /* More space */
    padding: 12px;
    border-radius: 8px; /* Rounded messages */
    text-align: center;
    font-size: 1em;
    font-weight: bold;
    display: none;
    font-family: 'Inter', sans-serif; /* Consistent font */
}
#profileSelectorMessage.error {
    background-color: #ffcccc; /* Soft red background */
    color: #cc0000; /* Darker red text */
    border: 1px solid #ff9999;
}
#profileSelectorMessage.success {
    background-color: #ccffcc; /* Soft green background */
    color: #008000; /* Darker green text */
    border: 1px solid #99ff99;
}

/* --- Initial Wallet Setup Modal Styles --- */
#wallet-setup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* More opaque dim background for mandatory popup */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000; /* Even higher z-index to ensure it's on top */

    /* Initial hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
}

#wallet-setup-modal.wallet-setup-visible {
    opacity: 1;
    pointer-events: auto;
}

#wallet-setup-modal.wallet-setup-hidden {
    opacity: 0;
    pointer-events: none;
}

.wallet-setup-content {
    background: linear-gradient(135deg, #1f1f1f, #0f0f0f); /* Dark, subtle gradient */
    color: #e0e0e0;
    padding: 40px; /* More padding */
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8); /* Stronger shadow */
    width: 90%;
    max-width: 480px; /* Comfortable width */
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(-30px) scale(0.9); /* More pronounced animation */
    transition: transform 0.4s ease-out;
    border: 1px solid #444; /* Subtle border */
}

#wallet-setup-modal.wallet-setup-visible .wallet-setup-content {
    transform: translateY(0) scale(1);
}

.wallet-setup-content h2 {
    font-size: 2em; /* Larger heading */
    color: #FFD700; /* Gold-like color to highlight importance */
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
}

.wallet-setup-content p {
    text-align: center;
    font-size: 1.1em;
    color: #b0b0b0;
    margin-bottom: 30px;
    font-family: 'Inter', sans-serif;
}

#setupWalletInput {
    width: calc(100% - 24px); /* Adjust for padding and border */
    padding: 12px;
    margin: 0 auto 20px; /* Center with margin */
    display: block; /* Make it block to center with margin auto */
    background-color: #333;
    border: 1px solid #555;
    border-radius: 8px;
    color: white;
    font-size: 1em;
    font-family: 'Inter', sans-serif;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#setupWalletInput:focus {
    border-color: #007bff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 0 0 3px rgba(0, 123, 255, 0.3);
}

#setupWalletSaveBtn {
    display: block;
    width: 70%;
    margin: 0 auto;
    padding: 15px 25px;
    background: linear-gradient(45deg, #FFD700, #DAA520); /* Gold gradient for save */
    color: #333; /* Dark text on gold */
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4); /* Gold button shadow */
    font-family: 'Inter', sans-serif;
}

#setupWalletSaveBtn:hover {
    background: linear-gradient(45deg, #DAA520, #FFD700);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

#setupWalletMessage {
    margin-top: 25px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 1em;
    font-weight: bold;
    display: none;
    font-family: 'Inter', sans-serif;
}
#setupWalletMessage.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
#setupWalletMessage.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* --- Loading Progress Bar Modal Styles --- */
#loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Darker, almost black background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000; /* Highest z-index to cover everything else */

    /* Initial hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#loading-modal.loading-visible {
    opacity: 1;
    pointer-events: auto;
}

#loading-modal.loading-hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a); /* Subtle dark gradient */
    color: #e0e0e0;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    text-align: center;
    width: 90%;
    max-width: 400px;
    transform: translateY(-20px); /* Slight lift animation */
    transition: transform 0.3s ease-out;
    border: 1px solid #555;
}

#loading-modal.loading-visible .loading-content {
    transform: translateY(0);
}

.spinner {
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid #007bff; /* Blue spinner */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.5s linear infinite;
    margin: 0 auto 20px; /* Center the spinner */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingMessage {
    font-size: 1.2em;
    font-weight: bold;
    color: #b0b0b0; /* Lighter grey for message */
    font-family: 'Inter', sans-serif;
}

/*/////////////////*/
/* assessment.css */
/*//////////////////*/

/* assessment.css */

#assessment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#assessment-window {
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    width: 98%;
    max-width: 1700px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #4a627a;
}

.assessment-header {
    padding: 15px 25px;
    background-color: #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #4a627a;
    flex-shrink: 0;
}

.assessment-header h2 { margin: 0; font-size: 1.5em; }

.assessment-close-btn {
    background: none; border: none; color: #ecf0f1; font-size: 2.2em;
    cursor: pointer; line-height: 1; transition: transform 0.2s, color 0.2s;
}
.assessment-close-btn:hover { transform: rotate(90deg); color: #e74c3c; }

.assessment-content {
    padding: 0 25px 25px 25px;
    overflow-y: auto;
    flex-grow: 1;
}

.assessment-content h3 {
    color: #1abc9c; border-bottom: 2px solid #1abc9c; padding-bottom: 8px;
    margin-top: 25px; margin-bottom: 20px; font-size: 1.4em;
    position: sticky; top: 0; background-color: #2c3e50; z-index: 10;
}

/* TABS */
.tab-nav {
    display: flex; border-bottom: 2px solid #4a627a; margin-bottom: 20px;
    flex-wrap: wrap;
}
.tab-button {
    padding: 10px 20px; background: none; border: none; color: #bdc3c7;
    cursor: pointer; font-size: 1.1em; border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s; margin-right: 5px;
}
.tab-button.active { color: #1abc9c; border-bottom-color: #1abc9c; font-weight: bold; }
.tab-button:hover:not(.active) { color: #ecf0f1; background-color: rgba(255, 255, 255, 0.1); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s; }

.sub-tab {
    border-bottom: 1px solid #4a627a;
    margin-bottom: 15px;
}
.sub-tab .tab-button {
    font-size: 0.9em;
    padding: 8px 15px;
    color: #95a5a6;
}
.sub-tab .tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* STARBASE & FLEET LIST */
.starbase-group {
    margin-bottom: 20px; background-color: rgba(0, 0, 0, 0.1); border-radius: 6px;
    transition: background-color 0.3s;
}
.starbase-title {
    font-size: 1.5em; color: #3498db; margin: 0; padding: 20px;
    cursor: pointer; position: relative; border-bottom: 1px solid #4a627a;
}
.starbase-title::after {
    content: '−'; position: absolute; right: 20px; top: 50%;
    transform: translateY(-50%); font-size: 1.5em; transition: transform 0.3s ease-in-out;
}
.starbase-group.collapsed .starbase-title::after {
    transform: translateY(-50%) rotate(135deg);
}
.starbase-content {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease-out;
}
.starbase-group.collapsed .starbase-content {
    grid-template-rows: 0fr;
}
.starbase-content > div {
    overflow: hidden;
    padding: 20px;
    transition: padding 0.3s ease-out;
}
.starbase-group.collapsed .starbase-content > div {
    padding-top: 0;
    padding-bottom: 0;
}


.fleet-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
}

/* COMPACT FLEET CARD */
.fleet-card-compact {
    position: relative;
    background: #34495e;
    border-radius: 5px;
    border-left: 4px solid #1abc9c;
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
    overflow: hidden;
    flex-grow: 1;
}
.fleet-card-compact .card-header {
    padding: 8px 12px; font-weight: bold; background: #4a627a;
    border-top-left-radius: 4px; border-bottom: 1px solid #2c3e50;
    text-align: center;
    position: relative; /* Positioning context for the toggle */
}

.fleet-card-compact .card-body { padding: 10px 12px; flex-grow: 1; }

.fleet-card-compact .card-body-mining {
    padding: 10px 12px; flex-grow: 1; text-align: center; font-size: 1.8em; font-weight: bold;
    display: flex; justify-content: center; align-items: center; color: #2ecc71;
}
.fleet-card-compact .card-body-mining p { margin: 0; }

.fleet-card-compact .card-body-crafting {
    padding: 10px 12px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center;
    align-items: center; /* This handles horizontal centering */
}
.crafting-io-section {
    margin-bottom: 10px;
    width: 100%;
    text-align: center;
}
.crafting-io-section:last-child { margin-bottom: 0; }
.crafting-io-section strong { color: #bdc3c7; font-size: 0.9em; text-transform: uppercase; }
.crafting-output {
    font-size: 1.4em; font-weight: bold; text-align: center; padding: 8px 12px;
    border-top: 1px solid #4a627a; background-color: rgba(0,0,0,0.2);
}

.card-body-transport {
    display: flex;
    flex-grow: 1;
    justify-content: space-around;
    padding: 10px 12px;
}
.transport-leg { flex-basis: 48%; }
.transport-leg-header { font-weight: bold; color: #bdc3c7; text-align: center; margin-bottom: 5px;
    padding: 8px 12px; background: #4a627a;
    border-top-left-radius: 4px; border-bottom: 1px solid #2c3e50;
    position: relative; /* Positioning context for the toggle */
}


.transport-separator { border-left: 1px solid #4a627a; }
.transport-leg ul {
    list-style: none; padding: 0; margin-top: 5px; text-align: center;
}
.transport-leg ul li { margin-bottom: 3px; }

.fleet-card-compact .card-body p { margin: 0 0 6px 0; }
.fleet-card-compact .card-body strong { color: #bdc3c7; }
.fleet-card-compact .card-footer {
    flex-shrink: 0;
    padding: 6px 12px; background-color: rgba(0,0,0,0.2); border-top: 1px solid #4a627a;
    display: flex; justify-content: space-between; font-size: 0.9em; color: #95a5a6; flex-wrap: nowrap;
    text-align: center;
}
.fleet-card-compact .card-footer.centered { justify-content: center; }
.fleet-card-compact .card-footer .footer-item { white-space: nowrap; text-align: center; flex: 1; }

.consumption-value { color: #ff7675; font-weight: bold; }
.positive-net { color: #2ecc71; }
.negative-net { color: #ff7675; }

ul { list-style: none; padding: 0; margin: 0; }
li { padding: 2px 0; }
.empty-state {
    padding: 20px; text-align: center; color: #95a5a6; font-style: italic;
}

/* SUMMARY CARDS */
.summary-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); /* Increased card size */
    gap: 20px;
}
.summary-card {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}
.summary-card-header {
    font-size: 1.2em; color: #3498db; padding: 15px;
    border-bottom: 1px solid #4a627a; font-weight: bold;
    text-align: center;
}
.summary-card-body { padding: 15px; }
.summary-resource-list {
    list-style: none; padding: 0; margin: 0;
}
.summary-card-body { padding: 15px; display: flex; flex-direction: column; justify-content: center; flex-grow: 1; }

.summary-card-split-body {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.summary-column {
    flex: 1;
    padding: 0 10px;
}
.summary-column-header {
    text-align: center;
    color: #bdc3c7;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1em;
    text-transform: uppercase;
    padding: 5px 10px;
    background-color: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.summary-column-separator {
    width: 1px;
    background-color: #4a627a;
    margin: 0 10px;
}

.summary-resource-list li {
    display: flex;
    justify-content: center; /* This centers the content block (name + value) */
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px solid #3a5067;
}
/* For split view, push to edges */
.summary-card-split-body .summary-resource-list li {
    justify-content: space-between;
}

.summary-resource-list li .resource-name {
    margin-right: 15px; /* Add space between name and value */
    word-break: break-word;
}
.summary-resource-list li:last-child { border-bottom: none; }
.summary-resource-list li span:last-child { font-weight: bold; white-space: nowrap; }
.summary-resource-list .none-item {
    justify-content: center;
    color: #7f8c8d;
    font-style: italic;
    border-bottom: none;
}

.consumption-separator {
    border-bottom: 1px solid #4a627a;
    margin: 15px 0;
}
.upkeep-grid {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 10px 0;
}
.upkeep-item span {
    font-size: 0.9em;
    color: #bdc3c7;
    display: block;
    margin-bottom: 5px;
}
.upkeep-item strong {
    font-size: 1.2em;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* SUMMARY TABLE (For Net Flow) */
.summary-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.summary-table th, .summary-table td {
    padding: 10px 15px; text-align: left; border-bottom: 1px solid #4a627a;
}
.summary-table th { background-color: #4a627a; font-weight: bold; }
.summary-table tbody tr:nth-child(even) { background-color: #3a5067; }
.summary-table tbody tr:hover { background-color: #526f8c; }
.simple-table td:last-child { text-align: right; font-weight: bold; }

/* TOGGLE SWITCH */

.full-craft-toggle {
    position: relative; /* Changed from absolute */
    display: inline-block;
    width: 40px;
    height: 20px;
}

.full-craft-toggle input { display: none; }
.full-craft-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #7f8c8d;
    transition: .4s;
    border-radius: 20px;
}

.full-craft-toggle .slider:before {
    position: absolute;
    content: "";
    height: 14px; width: 14px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.full-craft-toggle input:checked + .slider { background-color: #2980b9; }
.full-craft-toggle input:checked + .slider:before { transform: translateX(20px); }


.hidden { display: none !important; }

.add-mining-btn,
.add-transport-btn,
.add-craft-btn { /* Apply common styles to all add buttons */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: #4a5a7c;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-height: 150px; /* Ensure it has a decent size */
    background: #34495e; /* Match other fleet card backgrounds */
    border-radius: 5px;
    border: 1px dashed #4a5a7c; /* Dashed border to indicate it's an "add" button */
    /* Ensure these also behave as grid items */
    box-sizing: border-box; /* Important for consistent sizing in flex/grid */
}

.add-mining-btn:hover,
.add-transport-btn:hover,
.add-craft-btn:hover {
    background-color: rgba(30, 42, 69, 0.8);
    color: #7a8aAc;
    border-color: #7a8aAc; /* Change border color on hover */
}


.card-header-controls {
    display: flex;
    justify-content: space-between; /* This correctly separates the items */
    align-items: center;
    padding: 5px 8px;
    background-color: #4a627a;
    min-height: 28px; /* Ensure consistent height */
}

/* --- Delete Button Styling --- */
.delete-craft-btn {
    background: none;
    border: none;
    color: #8a9bbd;
    font-size: 1.8em;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 0 5px;
    line-height: 1;
}

.delete-craft-btn:hover {
    color: #ff6a6a; /* Red on hover */
    transform: scale(1.2);
}

/* --- Recipe Selector & Crew Input Improvements --- */
.recipe-selector-container {
    position: relative;
    padding: 4px 12px 8px 12px;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #2c3e50;
}

.recipe-search-input {
    width: 100%;
    background-color: #121827;
    border: 1px solid #3c4b6c;
    color: #cdd8f0;
    padding: 6px;
    border-radius: 3px;
    box-sizing: border-box;
    text-align: center;
    font-size: 1.1em;
}

.recipe-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #1e2a45;
    border: 1px solid #3c4b6c;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.recipe-dropdown.active {
    display: block;
}

.recipe-dropdown-item {
    padding: 8px 12px;
    color: #cdd8f0;
    cursor: pointer;
}

.recipe-dropdown-item:hover {
    background-color: #2a3b5c;
}

.crew-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.crew-input-container label {
    margin-bottom: 0;
}

.recipe-variant-selector-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0;
    padding: 0 12px;
}

.recipe-variant-selector-container label {
    font-size: 0.9em;
    color: #bdc3c7;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

.recipe-variant-select {
    width: 100%;
    background-color: #121827;
    border: 1px solid #3c4b6c;
    color: #cdd8f0;
    padding: 6px;
    border-radius: 3px;
    box-sizing: border-box;
    text-align: center;
    font-size: 1.1em;
}

.recipe-variant-select:focus {
    border-color: #1abc9c;
    outline: none;
    box-shadow: 0 0 5px rgba(26, 188, 156, 0.5);
}

.intermediate-inputs-section, .raw-inputs-section {
    margin-top: 15px;
    border: 1px solid #4a627a;
    border-radius: 6px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.1);
}

.intermediate-inputs-section .section-header, .raw-inputs-section .section-header {
    font-size: 1.1em;
    color: #1abc9c;
    border-bottom: 1px solid #1abc9c;
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: bold;
}

.crafting-input-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px dashed #4a627a;
}

.crafting-input-item:last-child {
    border-bottom: none;
}

.recipe-selector-container.input-variant-selector {
    background-color: rgba(0, 0, 0, 0.1); /* Slightly darker background for nested variants */
    border: 1px dashed #4a627a; /* Dashed border for nested variants */
    padding: 5px 8px; /* Reduced padding for nesting */
    border-radius: 4px;
    margin-left: 10px; /* Indent nested variants */
}

.fleet-detail-content .detail-field.recipe-selector-container {
    position: relative; /* Maintain position for dropdown */
    padding: 8px 15px; /* Adjust padding for detail view */
    background-color: #34495e; /* Consistent background */
    border: 1px solid #4a627a; /* Add border for definition */
    border-radius: 5px; /* Match other detail fields */
    margin-bottom: 10px; /* Space below this group */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Space between recipe input and nested selectors */
}

.fleet-detail-content .detail-field.recipe-selector-container label {
    margin-bottom: 5px;
    font-size: 1em; /* Keep label size consistent with detail-field labels */
}

.input-recipe-variant-select {
    width: 100%; /* Ensure it spans full width */
    font-size: 1.0em; /* Smaller font for nested dropdowns */
    text-align: center;
}

.recipe-variant-select {
    width: 100%; /* Take full width within its container */
    background-color: #121827;
    border: 1px solid #3c4b6c;
    color: #cdd8f0;
    padding: 6px;
    border-radius: 3px;
    box-sizing: border-box;
    text-align: center;
    font-size: 1em; /* Slightly smaller font than main recipe input */
}

.crew-input {
    width: 70px;
    background-color: #121827;
    border: 1px solid #3c4b6c;
    color: #cdd8f0;
    padding: 4px;
    border-radius: 3px;
    text-align: center;
}

.crafting-output .positive-net {
    font-size: 1.5em;
    font-weight: bold;
    display: block;
    text-align: center;
    margin: 0;
}

.detail-field.output-display-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid #4a627a;
    border-radius: 8px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.1);
}

.output-value-detail {
    font-size: 1.5em;
    font-weight: bold;
    color: #2ecc71;
    text-align: center;
    display: block;
    width: 100%;
    margin: 0;
}

.crafting-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.full-craft-toggle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.full-craft-toggle-container span {
    color: #cdd8f0;
    font-size: 0.9em;
    font-weight: bold;
}
.detail-inputs-display {
    border: 1px solid #4a627a;
    border-radius: 8px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.1);
    margin-top: 15px;
}

.detail-inputs-display label {
    font-size: 0.9em;
    color: #bdc3c7;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    border-bottom: 1px solid #4a627a;
    padding-bottom: 5px;
}

#fleet-detail-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Dim background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Higher than assessment window, lower than loading */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    min-width: 300px;
}

#fleet-detail-popup-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#fleet-detail-popup {
    background-color: #2c3e50; /* Dark blue-grey */
    color: #ecf0f1;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 600px; /* Comfortable width for details */
    max-height: 90vh; /* Max height to allow scrolling */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #4a627a;
    transform: translateY(-30px); /* Initial slightly off-center for animation */
    transition: transform 0.3s ease-out;
}

#fleet-detail-wide-popup {
    background-color: #2c3e50; /* Dark blue-grey */
    color: #ecf0f1;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 1200px; /* Comfortable width for details */
    max-height: 90vh; /* Max height to allow scrolling */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #4a627a;
    transform: translateY(-30px); /* Initial slightly off-center for animation */
    transition: transform 0.3s ease-out;
}

#fleet-detail-popup-overlay.visible #fleet-detail-popup {
    transform: translateY(0); /* Slide into center */
}

.fleet-detail-header {
    padding: 8px 25px; /* Reduced vertical padding */
    background-color: #34495e;
    display: flex;
    justify-content: center; /* Center content horizontally */
    align-items: center;
    border-bottom: 1px solid #4a627a;
    flex-shrink: 0;
    position: relative; /* Make it a positioning context for the close button */
}

.fleet-detail-header h2 {
    font-size: 1.2em; /* Smaller font for title */
    margin: 0; /* Remove default margins */
    text-align: center;
}

.fleet-detail-close-btn {
    position: absolute; /* Position absolutely to not affect flex layout */
    right: 15px; /* Adjust as needed */
    top: 50%;
    transform: translateY(-50%); /* Vertically center */
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 2.2em;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s, color 0.2s;
}

.detail-flex-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.crafting-dynamic-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #4a627a;
    margin-bottom: 10px;
}

.detail-stats-summary.transport-fuel-summary {
    display: none;
}

.detail-stats-summary.transport-fuel-summary h4 {
    display: none;
}

.fleet-detail-close-btn:hover {
    transform: translateY(-50%) rotate(90deg);
    color: #e74c3c;
}

/* New styles to mimic compact transport card body */
.compact-transport-display {
    display: flex;
    justify-content: space-around;
    padding: 10px 0; /* Match card body padding */
    border-top: 1px solid #4a627a; /* Add separator from above sections */
    margin-top: 15px; /* Space from previous sections */
    flex-grow: 1; /* Allow it to take available height */
}

.compact-transport-display .transport-leg {
    flex-basis: 48%; /* Match compact card */
    display: flex;
    flex-direction: column; /* Stack header and list vertically */
}

.compact-transport-display .transport-leg-header {
    font-weight: bold;
    color: #bdc3c7;
    text-align: center;
    margin-bottom: 5px;
    padding: 8px 12px;
    background: #4a627a;
    border-top-left-radius: 4px;
    border-bottom: 1px solid #2c3e50;
    position: relative;
}

.compact-transport-display .transport-separator {
    border-left: 1px solid #4a627a;
}

.compact-transport-display .transport-leg ul {
    list-style: none;
    padding: 0;
    margin-top: 5px;
    text-align: center;
    flex-grow: 1; /* Allow the list to expand */
}

.compact-transport-display .transport-leg ul li {
    margin-bottom: 3px;
    font-size: 0.9em; /* Adjust font size to match compact card */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis */
}

/* Reusing existing card-footer for consistency at the bottom of the popup */
.fleet-detail-content > .card-footer { /* Target the footer if it's a direct child of content */
    margin-top: 15px; /* Space from the transport display above it */
    padding: 6px 12px; /* Match compact card footer padding */
    background-color: rgba(0,0,0,0.2);
    border-top: 1px solid #4a627a;
    display: flex;
    justify-content: center; /* Ensure centered as per 'centered' class */
    font-size: 0.9em;
    color: #95a5a6;
    flex-shrink: 0; /* Prevent it from shrinking */
}

.fleet-detail-content > .card-footer span {
    text-align: center;
}

.detail-stats-summary.transport-fuel-summary .main-fuel-value {
    font-size: 2.5em; /* Large font for the main fuel number */
    font-weight: bold;
    color: #ff7675; /* Red color for fuel consumption */
    margin: 5px 0 10px 0; /* Adjusted margins */
    border-bottom: 1px solid #4a627a; /* Add a separator */
    padding-bottom: 10px; /* Space below separator */
    width: 100%; /* Ensure it spans full width */
}

.detail-stats-summary.transport-fuel-summary .consumption-row {
    flex-direction: column; /* Stack fuel label and value vertically */
    border-top: none; /* No top border needed here */
    padding-top: 0;
    align-items: center; /* Center content within the column */
}

.detail-stats-summary.transport-fuel-summary .consumption-item {
    flex: none; /* Do not flex, take only required space */
    margin: 0; /* Remove extra margins */
}

.detail-stats-summary.transport-fuel-summary .consumption-separator {
    display: none; /* Hide separators as there's only one item */
}

.fleet-detail-content {
    padding: 20px 25px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between fields */
}

.detail-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.detail-field label {
    font-size: 0.9em;
    color: #bdc3c7;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: bold;
}

.detail-field select,
.detail-field input[type="text"],
.detail-field input[type="number"] {
    background-color: #34495e;
    border: 1px solid #4a627a;
    color: #ecf0f1;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.detail-field select:focus,
.detail-field input[type="text"]:focus,
.detail-field input[type="number"]:focus {
    border-color: #1abc9c;
    outline: none;
    box-shadow: 0 0 5px rgba(26, 188, 156, 0.5);
}

.detail-checkbox-group {
    display: flex;
    flex-direction: column; /* Stack checkboxes vertically */
    gap: 10px;
    margin-bottom: 15px;
}

.detail-checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #ecf0f1;
}

.detail-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px; /* Larger checkbox */
    height: 18px;
    accent-color: #1abc9c; /* Green accent color */
}

.detail-cargo-section {
    border: 1px solid #4a627a;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.1);
}

.detail-cargo-section h4 {
    display: flex; /* Use flexbox */
    justify-content: space-between; /* Space out title and capacity */
    align-items: baseline; /* Align text baselines */
    color: #3498db;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #3498db;
    padding-bottom: 5px;
}

.cargo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.resource-selector-container {
    position: relative;
    flex: 2.5;
    min-width: 100px; /* Ensure it has enough space */
}

.resource-search-input {
    width: 100%;
    background-color: #2c3e50; /* Darker background for input */
    border: 1px solid #4a627a;
    color: #ecf0f1;
    padding: 6px 8px;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

.resource-search-input:focus {
    border-color: #1abc9c;
    outline: none;
    box-shadow: 0 0 5px rgba(26, 188, 156, 0.5);
}

.resource-dropdown {
    display: none;
    position: absolute;
    top: 100%; /* Position below the input */
    left: 0;
    right: 0;
    background-color: #1e2a45; /* Dark background for dropdown */
    border: 1px solid #3c4b6c;
    z-index: 100; /* Ensure it's above other content */
    max-height: 150px; /* Limit height for scroll */
    overflow-y: auto;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.resource-dropdown.active {
    display: block;
}

.resource-dropdown-item {
    padding: 8px 12px;
    color: #cdd8f0;
    cursor: pointer;
    white-space: nowrap; /* Prevent wrapping of long names */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long names */
}

.resource-dropdown-item:hover {
    background-color: #2a3b5c; /* Hover background */
}

.detail-cargo-section.fuel-cargo-section {
    border: 1px solid #0fc1cc;
    background-color: rgba(46, 204, 113, 0.05); /* Light green background */
}

.detail-cargo-section.fuel-cargo-section h4 {
    color: #0fc1cc;
    border-bottom: 1px solid #0fc1cc;
}

/* Fuel Capacity Display */
.fuel-capacity-display {
    color: #0fc1cc;
    font-size: 0.8em;
    margin-left: 10px;
    font-weight: normal;
}

/* New: Styles for Ammunition Cargo Section */
.detail-cargo-section.ammo-cargo-section {
    border: 1px solid #bf941a;
    background-color: rgba(231, 76, 60, 0.05); /* Light red background */
}

.detail-cargo-section.ammo-cargo-section h4 {
    color: #bf941a;
    border-bottom: 1px solid #bf941a;
}

/* Ammo Capacity Display */
.ammo-capacity-display {
    color: #bf941a;
    font-size: 0.8em;
    margin-left: 10px;
    font-weight: normal;
}

/* General Cargo Capacity Display (unchanged, but noted for context) */
.cargo-capacity-display {
    font-size: 0.8em;
    color: #95a5a6; /* Default color for main cargo */
    margin-left: 10px;
    font-weight: normal;
}

/* Overload display for any cargo type */
.cargo-capacity-display-overload {
    font-size: 0.8em;
    color: #e74c3c; /* Red color for overload */
    margin-left: 10px;
    font-weight: bold; /* Make it bold when overloaded */
}

/* Adjusting cargo item layout for better alignment and spacing */
.cargo-item {
    display: flex;
    align-items: center; /* Vertically align items in the middle */
    gap: 6px; /* Restored original gap for slightly more space */
    background-color: #34495e;
    padding: 8px 12px;
    border-radius: 5px;
    position: relative;
}

/* Resource Name Input (container for input and dropdown) */
.resource-selector-container {
    position: relative;
    flex: 1.5; /* Adjusted flex to be more balanced with quantity */
    min-width: 100px; /* Ensure it has enough space */
}

.resource-search-input {
    width: 100%;
    /* Existing styles */
    background-color: #2c3e50;
    border: 1px solid #4a627a;
    color: #ecf0f1;
    padding: 6px 8px; /* Consistent padding with number input */
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}


/* Quantity Input */
.cargo-item input[type="number"] {
    flex: 1; /* Adjusted flex to be relatively larger, aiming for similar visual size to resource name */
    max-width: 80px; /* Increased max-width slightly for better number display */
    padding: 6px 8px; /* Consistent padding */
    background-color: #2c3e50;
    border: 1px solid #4a627a;
    color: #ecf0f1;
    border-radius: 4px;
    text-align: right;
    flex-shrink: 0;
}

/* Style for the new "Full" button */
.fill-cargo-btn {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px; /* Increased padding for larger button */
    font-size: 0.9em; /* Increased font size */
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.fill-cargo-btn:hover {
    background-color: #217dbb;
    transform: translateY(-1px);
}

/* Style for the Remove button */
.remove-cargo-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.8em; /* Increased font size for larger 'x' */
    cursor: pointer;
    padding: 0 6px; /* Increased padding for better click area */
    transition: transform 0.2s;
    flex-shrink: 0;
    line-height: 1;
    align-self: center;
}
.remove-cargo-btn:hover {
    transform: scale(1.15);
}

/* Style for the cargo capacity display in section headers */
.cargo-capacity-display {
    font-size: 0.8em; /* Smaller font size for capacity */
    color: #95a5a6; /* Lighter color */
    margin-left: 10px; /* Space from the main title */
    font-weight: normal; /* Override bold from h4 */
}

/* Add a specific style for no-match/loading items in dropdown if needed */
.resource-dropdown-item.no-match,
.resource-dropdown-item.loading {
    color: #95a5a6;
    font-style: italic;
    cursor: default;
    background-color: transparent;
}
.resource-dropdown-item.no-match:hover,
.resource-dropdown-item.loading:hover {
    background-color: transparent;
}

.cargo-capacity-display-overload {
    font-size: 0.8em;
    color: #e74c3c; /* Red color for overload */
    margin-left: 10px;
    font-weight: bold; /* Make it bold when overloaded */
}

.add-cargo-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background-color: #1abc9c; /* Green add button */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}
.add-cargo-btn:hover {
    background-color: #16a085;
}

.fleet-card-compact .card-content-wrapper {
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; /* Add transition for hover effects */
}

.fleet-card-compact .card-content-wrapper:hover {
    background-color: rgba(26, 188, 156, 0.1); /* Light green tint on hover */
    transform: translateY(-3px); /* Slightly lift the card */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); /* Add a subtle shadow */
}

/* Add to style.css */
.detail-stats-summary {
    background-color: #34495e; /* Match compact card background */
    border: 1px solid #4a627a;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    display: flex; /* Use flexbox for layout */
    flex-direction: column; /* Stack elements vertically */
    align-items: center; /* Center content horizontally */
    text-align: center; /* Ensure text is centered */
}

.detail-stats-summary h4 {
    color: #1abc9c;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #1abc9c;
    padding-bottom: 5px;
    width: 100%; /* Ensure heading spans full width */
}
.detail-stats-summary p {
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detail-stats-summary .main-production-value {
    font-size: 2.5em; /* Larger font for main production number */
    font-weight: bold;
    color: #2ecc71; /* Green color for positive production */
    margin-bottom: 15px; /* Space below production number */
}

.detail-stats-summary .consumption-row {
    display: flex;
    justify-content: space-around; /* Distribute space evenly */
    width: 100%; /* Take full width */
    font-size: 0.9em;
    color: #95a5a6;
    border-top: 1px solid #4a627a; /* Separator like in compact card */
    padding-top: 10px;
}

.detail-stats-summary .consumption-item {
    text-align: center;
    flex: 1; /* Each item takes equal space */
}

.detail-stats-summary .consumption-value {
    color: #ff7675; /* Red for consumption */
    font-weight: bold;
    display: block; /* Ensure value is on new line */
    margin-top: 5px; /* Space between label and value */
}

/* Separator for consumption items, similar to compact card */
.detail-stats-summary .consumption-separator {
    border-left: 1px solid #4a627a;
    height: 30px; /* Adjust height as needed */
    margin: 0 10px; /* Space around separator */
}

/* Styles for the new Save button */
.assessment-save-btn {
    background-color: #34495e; /* Darker blue-grey to match header background */
    color: #1abc9c; /* Green accent color for text */
    border: 1px solid #1abc9c; /* Green border */
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
    /* Adjusted margin to push it to the left, next to the title */
    margin-right: auto; /* Pushes the button to the left, next to the title */
    margin-left: 15px; /* Added left margin to create space from the title */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
}

.assessment-save-btn:hover {
    background-color: #1abc9c; /* Invert colors on hover */
    color: #34495e; /* Darker text on hover */
    border-color: #1abc9c; /* Keep border color consistent or change slightly */
    transform: translateY(-1px); /* Slight lift effect */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Enhanced shadow on hover */
}

.assessment-smart-btn {
    background-color: #34405e; /* Darker blue-grey to match header background */
    color: #559cc3; /* Green accent color for text */
    border: 1px solid #1a79bc; /* Green border */
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
    /* Adjusted margin to push it to the left, next to the title */
    margin-right: auto; /* Pushes the button to the left, next to the title */
    margin-left: 15px; /* Added left margin to create space from the title */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
}

.assessment-smart-btn:hover {
    background-color: #1a7ebc; /* Invert colors on hover */
    color: #34405e; /* Darker text on hover */
    border-color: #1abc9c; /* Keep border color consistent or change slightly */
    transform: translateY(-1px); /* Slight lift effect */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Enhanced shadow on hover */
}


/* New styles for fleet selector popups */
.fleet-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Higher than main assessment window */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

.fleet-selector-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/*
.fleet-selector-popup {
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6);
    width: 90%;
    min-width: 400px;
    max-width: 1600px;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #4a627a;
    transform: translateY(-30px);
    transition: transform 0.3s ease-out;
}*/

.fleet-selector-popup {
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6);

    display: flex;
    flex-direction: column; /* Stack header and content vertically */
    width: 95vw;            /* Use most of the viewport width */
    max-width: 1700px;      /* Set a reasonable max-width */
    height: 90vh;           /* Use 90% of the viewport height */
    overflow: hidden;       /* IMPORTANT: Prevent the popup itself from getting scrollbars */

    transform: translateY(-30px);
    transition: transform 0.3s ease-out;
}

.fleet-selector-overlay.visible .fleet-selector-popup {
    transform: translateY(0);
}

.fleet-selector-header {
    padding: 10px 25px;
    background-color: #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #4a627a;
    flex-shrink: 0;
}

.fleet-selector-header h2 {
    margin: 0;
    font-size: 1.4em;
}

.fleet-selector-close-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 2.2em;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s, color 0.2s;
}
.fleet-selector-close-btn:hover {
    transform: rotate(90deg);
    color: #e74c3c;
}

.fleet-selector-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/*
.fleet-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
    padding: 10px 0;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    max-height: 900px;
    overflow: hidden;
}*/

.fleet-carousel {
    /*display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;*/
    padding: 20px 15px;
    overflow: visible;
    max-height: none; /* Make sure this is not set */
    background-color: rgba(0, 0, 0, 0.1);
}

.fleet-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.fleet-selection-card {
    padding: 0; /* Remove overall padding, sections will add their own */
    border: 1px solid #556677;
    border-radius: 8px;
    background-color: #2a3442;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    align-items: center;
    transition: all 0.2s ease-in-out;
}

.selection-card-header {
    background-color: #3f546c; /* Slightly different background color */
    border-bottom: 1px solid #5a728b; /* Add a bottom border */
    border-radius: 8px 8px 0 0; /* Match parent border-radius on top */
    padding: 10px 15px; /* Padding for the header */
    text-align: center;
}

.selection-card-header h3 {
    margin: 0;
    font-size: 1.3em; /* Slightly larger font for distinction */
    color: #ecf0f1;
}

/* New Subheader Style for Resource Cost */
.selection-card-subheader.cost-subheader {
    background-color: #405263; /* Distinct background for subheader */
    padding: 8px 15px;
    text-align: center;
    font-size: 1em;
    color: #bdc3c7; /* Lighter text color for context */
    font-weight: bold;
    border-bottom: 1px solid #365970;
}

.fleet-selection-card.insufficient-crew {
    border: 2px solid rgba(255, 80, 80, 0.8);
    box-shadow: 0 0 5px rgba(255, 80, 80, 0.5);
    background-color: #984444; /* Distinct background for subheader */
}

.fleet-selection-card.not-enough-fuel-for-full-trip {
    border: 2px solid rgba(255, 158, 81, 0.8);
    box-shadow: 0 0 5px rgba(221, 116, 1, 0.5);
}

.selection-card-subheader .cost-value {
    color: #ff6a6a; /* Bold Red */
    font-weight: bold;
}

.selection-card-subheader .rate-value {
    color: #b2e1f8; /* Bold Red */
    font-weight: bold;
}

/* Mining Body Layout */
.selection-card-body-mining {
    display: flex;
    justify-content: space-around; /* Distribute items horizontally */
    padding: 15px; /* Padding for the body section */
    flex-wrap: wrap; /* Allow wrapping if space is tight */
    gap: 10px; /* Space between stat groups */
}

.mining-stat-group {
    display: flex;
    flex-direction: column; /* Stack title and value */
    align-items: center; /* Center horizontally */
    flex: 1; /* Allow to grow */
    min-width: 120px; /* Ensure minimum width */
}

.mining-stat-group .stat-title {
    font-size: 0.9em;
    color: #bdc3c7;
    margin-bottom: 3px; /* Space between title and value */
    text-transform: uppercase;
}

.mining-stat-group .stat-value {
    font-size: 1.1em;
    color: #2ecc71; /* Green for positive stats */
    font-weight: bold;
    margin: 0;
}

/* Selection Card Footer */
.selection-card-footer {
    padding: 10px 15px; /* Padding for the footer section */
    background-color: rgba(0,0,0,0.2);
    border-top: 1px solid #4a627a;
    border-radius: 0 0 8px 8px; /* Match parent border-radius on bottom */
    display: flex;
    flex-direction: column; /* Stack consumption row and solana fee line */
    gap: 10px; /* Space between consumption and solana fee */
}

/* Reusing consumption-row for Ammu/Food/Fuel layout */
.selection-card-footer .consumption-row {
    display: flex;
    justify-content: space-around;
    font-size: 0.9em;
    color: #95a5a6;
}

.selection-card-footer .consumption-row .consumption-item {
    text-align: center;
    flex: 1;
}
.selection-card-footer .consumption-row .consumption-item span {
    display: block; /* Make label and value stack vertically */
}


/* Solana Fee Line */
.solana-fee-line {
    text-align: center;
    font-size: 1em;
    color: #bdc3c7; /* Standard text color */
    font-weight: bold;
}

.solana-fee-line .solana-fee-value {
    color: #ff6a6a; /* Bold Red */
    font-weight: bold;
}

/* Adjust existing .fleet-selection-card .card-header to avoid conflict */
/* The new .selection-card-header takes precedence now */
.fleet-selection-card .card-header {
    display: none; /* Hide the old header now that selection-card-header is used */
}

/* Adjust .fleet-selection-card .card-footer to avoid conflict */
.fleet-selection-card .card-footer {
    display: none; /* Hide the old footer now that selection-card-footer is used */
}

/* Transport card specific adjustments to body and footer for consistent design */
.fleet-selection-card .card-body-transport-selection {
    /* Ensure it has proper padding and flex behavior */
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 10px; /* Space between paragraphs and transport legs */
}

.fleet-selection-card .card-body-transport-selection p {
    margin: 0; /* Remove default paragraph margin */
}

.fleet-selection-card .card-body-transport-selection .transport-leg {
    margin-top: 5px; /* Slightly less margin for transport legs in body */
}

.fleet-selection-card .card-body-transport-selection .transport-leg ul {
    margin-top: 3px; /* Slightly less margin for ul in transport legs */
}

.fleet-selection-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    border-color: #8899aa;
}

.fleet-selection-card .card-header {
    font-size: 1.2em;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 10px;
    text-align: center;
}

.fleet-selection-card .card-body-mining-selection,
.fleet-selection-card .card-body-transport-selection {
    flex-grow: 1;
}

.fleet-selection-card .card-body-mining-selection p,
.fleet-selection-card .card-body-transport-selection p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #bdc3c7;
}

.fleet-selection-card .card-footer {
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    border-top: 1px solid #4a627a;
    font-size: 0.85em;
    color: #95a5a6;
    flex-wrap: wrap;
}

.fleet-selection-card .card-footer span {
    text-align: center;
    flex: 1 1 45%; /* Allow wrapping */
    margin: 3px 0;
}

.fleet-selection-card .card-body-transport-selection {
    display: flex;
    flex-direction: column;
}

.fleet-selection-card .card-body-transport-selection .transport-leg {
    margin-top: 10px;
    background-color: rgba(0,0,0,0.1);
    padding: 5px;
    border-radius: 4px;
}
.fleet-selection-card .card-body-transport-selection .transport-leg-header {
    font-size: 0.9em;
    color: #1abc9c;
    text-align: center;
    margin-bottom: 5px;
}
.fleet-selection-card .card-body-transport-selection ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8em;
    color: #bdc3c7;
    text-align: center;
}
.fleet-selection-card .card-body-transport-selection ul li {
    margin-bottom: 2px;
}

.transport-selector-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
    background-color: rgba(0,0,0,0.1);
    padding: 15px;
    border-radius: 8px;
}
.transport-selector-controls .detail-flex-row {
    grid-column: span 2; /* Span across both columns */
    justify-content: space-around;
    padding-top: 10px;
    border-top: 1px solid #4a627a;
    margin-top: 10px;
}

/* Styling for the new container holding the header and delete button */
.card-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px; /* Match existing card-header padding */
    background: #4a627a; /* Match existing card-header background */
    border-top-left-radius: 4px;
    border-bottom: 1px solid #2c3e50;
}

/* Specific styling for the delete button on rented fleets */
.delete-rented-fleet-btn {
    background: none;
    border: none;
    color: #e74c3c; /* Red color for delete */
    font-size: 1.5em; /* Slightly larger 'x' */
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 0 5px; /* Adjust padding to control spacing */
    line-height: 1; /* Helps with vertical alignment */
}

.delete-rented-fleet-btn:hover {
    color: #c0392b; /* Darker red on hover */
    transform: scale(1.1);
}

/* Ensure the main card header styles are still applied to the text within the new container */
.card-header-with-controls .card-header {
    flex-grow: 1; /* Allows the title to take up available space */
    text-align: center; /* Keep the title centered */
    padding: 0; /* Remove padding here as it's on the parent container */
    background: none; /* Remove background as it's on the parent container */
    border: none; /* Remove border here */
}

.crafting-detail-top-controls {
    display: flex;
    justify-content: space-evenly; /* Distribute items with equal space around them */
    align-items: center; /* Vertically align items */
    gap: 30px; /* Space between the two main items (crews and full craft) */
    padding: 10px 0; /* Some vertical padding */
    border-bottom: 1px solid #4a627a; /* Separator */
    margin-bottom: 15px; /* Space below this section */
}

.crafting-detail-top-controls > .full-craft-toggle-container,
.crafting-detail-top-controls > .crew-input-container {
    flex: 1; /* Allow both items to grow and take available space */
    max-width: 48%; /* Optional: limit their individual max width slightly less than half to account for gap */
}

#fleet-detail-popup .crew-input-container .crew-input {
    width: 80px; /* Slightly increase default width for the input field */
    max-width: 100%; /* Allow it to scale up to 100% of its parent, which now has flex:1 */
}

#upgrading-job-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#upgrading-job-window.visible {
    opacity: 1;
    pointer-events: auto;
}

.upgrading-job-content {
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 1400px; /* Wider to accommodate more cards */
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #4a627a;
    transform: translateY(-20px);
    transition: transform 0.3s ease-out;
    z-index: 1;
}

#upgrading-job-window.visible .upgrading-job-content {
    transform: translateY(0);
}

.upgrading-job-header {
    padding: 15px 25px;
    background-color: #34495e;
    display: flex;
    justify-content: center; /* Center title */
    align-items: center;
    border-bottom: 1px solid #4a627a;
    position: relative;
    flex-shrink: 0;
}

.upgrading-job-header h2 {
    margin: 0;
    font-size: 1.5em;
}

#close-upgrading-job-window {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 2.2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: transform 0.2s, color 0.2s;
}

#close-upgrading-job-window:hover {
    transform: translateY(-50%) rotate(90deg);
    color: #e74c3c;
}

.upgrading-job-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.top-controls-container {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 20px;
    margin-bottom: 20px;
}

#starbase-select-container {
    flex: 0 1 350px; /* Set a base width, allowing it to shrink but not grow */
    margin-bottom: 0; /* Remove margin since the parent container has it */
}

#starbase-select {
    width: 100%;
    background-color: #34495e;
    border: 1px solid #4a627a;
    color: #ecf0f1;
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 1.1em;
    text-align: center;
}

#starbase-select:focus {
    border-color: #1abc9c;
    outline: none;
    box-shadow: 0 0 5px rgba(26, 188, 156, 0.5);
}

#target-select-container {
    flex: 0 1 350px; /* Set a base width, allowing it to shrink but not grow */
    margin-bottom: 0; /* Remove margin since the parent container has it */
}

#target-select {
    width: 100%;
    background-color: #34495e;
    border: 1px solid #4a627a;
    color: #ecf0f1;
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 1.1em;
    text-align: center;
}

#target-select:focus {
    border-color: #1abc9c;
    outline: none;
    box-shadow: 0 0 5px rgba(26, 188, 156, 0.5);
}

#upgrading-jobs-container {
    flex-grow: 1;
}

/* NEW: Recipe Group Styling */
.recipe-group {
    margin-bottom: 20px;
}

/* 1. Main Modal Body: The root container for scrolling */
#upgrading-job-window .upgrading-job-body {
    overflow-x: hidden; /* Explicitly PREVENT horizontal scrolling */
    overflow-y: auto;   /* ALLOW vertical scrolling */
}

/* 2. Box-Sizing: A critical rule to prevent padding/borders from breaking layouts */
#upgrading-jobs-container,
#upgrading-jobs-container * {
    box-sizing: border-box;
}

/* 3. Main Header Flex Container */
.recipe-group-header {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 15px;
    cursor: pointer;
    background-color: #1f2a38;
    border-left: 4px solid #1abc9c;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #1abc9c;
}

.recipe-group-header:hover {
    background-color: #2a3b50;
}

.recipe-title-wrapper {
    flex-grow: 1; /* Allows this section to take up available space */
}

.recipe-header-content {
    flex-grow: 1; /* Allow this to take up all available space */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Increase gap between rows */
    min-width: 0; /* CRITICAL: Allows this flex item to shrink */
}

/* Top row for title and numbers */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px 15px;
}

.recipe-group-title, .starbase-group-title {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0;
    margin-right: 15px; /* Ensure space between title and numbers */
    flex: 1 1 auto; /* Allow title to grow and shrink as needed */
    min-width: 0; /* CRITICAL: Allows title to shrink below its natural content size */
    word-break: break-word; /* Break long recipe names if necessary */
}

.recipe-progress-numbers {
    flex-shrink: 0;
    font-weight: bold;
    font-size: 1.1em;
    color: #cdd3da;
}

.recipe-progress-numbers .required-value {
    color: #7a8b99;
    font-size: 0.9em;
}

.deposited-value {
    color: #cdd3da;
}

.required-value {
    color: #7a8b99;
    font-size: 0.9em;
}

/* Progress Bar styles (mostly unchanged) */
.progress-bar-container {
    width: 100%;
    height: 12px;
    background-color: #2a3341;
    border-radius: 6px;
    display: flex;
    overflow: hidden;
}

.progress-bar-deposited {
    background-color: #4a90e2;
    height: 100%;
    transition: width 0.5s ease-in-out;
}

.progress-bar-ready {
    background-color: #fdd835; /* Solid gold/yellow */
    height: 100%;
    transition: width 0.5s ease-in-out;
}

.progress-bar-overflow {
    background-color: #e53935; /* Solid, cautionary red */
    height: 100%;
    transition: width 0.5s ease-in-out;
}

.progress-bar-production {
    background: repeating-linear-gradient(45deg, #7cb5ff, #7cb5ff 10px, #6facf7 10px, #6facf7 20px);
    height: 100%;
    transition: width 0.5s ease-in-out;
}

/* Projection details text */
.recipe-projection-details {
    font-size: 1.1em;
    color: #9ab;
    line-height: 1;
    margin-top: 4px;
    text-align:center;
}

/* Wrapper for the progress bar and numbers */
.recipe-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px; /* Adjust as needed */
    flex-shrink: 0; /* Prevents this from shrinking too much */
}

.recipe-group-title {
    font-size: 1.4em;
    font-weight: bold;
}

.recipe-group-quantity {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1em;
    color: #bdc3c7;
    background-color: #2c3e50;
    padding: 5px 15px;
    border-radius: 4px;
}

.collapse-indicator {
    font-size: 1.8em;
    right: 15px;
    top: 50%;
    transition: transform 0.3s ease-in-out;
}

.collapse-indicator-smart-transport {
    font-size: 1.8em;
    transition: transform 0.3s ease-in-out;
}

/* --- COLLAPSE ANIMATION FIX --- */
.job-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    overflow: hidden;
    max-height: 2000px; /* Set a large max-height for expanded state */
    opacity: 1;
    transition: max-height 0.5s ease-in-out, opacity 0.4s ease-in-out, margin-top 0.5s ease-in-out, padding 0.5s ease-in-out;
}

.recipe-group.collapsed .job-cards-grid {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    gap: 0;
}

.recipe-group.collapsed .collapse-indicator {
    transform: rotate(-90deg);
}

.upgrading-job-card {
    border-width: 0 0 0 5px;
    border-style: solid;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    background-color: #34495e; /* Set the base background color here */
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.upgrading-job-card.quantity-tier-1 {
    background-color: #2f4050; /* Default blue-grey */
    border-left-color: #758793;
}
.upgrading-job-card.quantity-tier-2 {
    background-color: #315045; /* Dark Green Tint */
    border-left-color: #4b815f;
}
.upgrading-job-card.quantity-tier-3 {
    background-color: #584a32; /* Dark Orange Tint */
    border-left-color: #f39c12;
}
.upgrading-job-card.quantity-tier-4 {
    background-color: #4a3d52; /* Dark Purple Tint */
    border-left-color: #9b59b6;
}

/* Lighter hover effects for the new backgrounds */
.upgrading-job-card.quantity-tier-1:hover { background-color: #415a75; }
.upgrading-job-card.quantity-tier-2:hover { background-color: #3c6355; }
.upgrading-job-card.quantity-tier-3:hover { background-color: #6c5a3c; }
.upgrading-job-card.quantity-tier-4:hover { background-color: #5a4a65; }

/* Colors to match the job card border tiers */
.legend-color-box.tier-1 { background-color: #758793; }
.legend-color-box.tier-2 { background-color: #4b815f; }
.legend-color-box.tier-3 { background-color: #f39c12; }
.legend-color-box.tier-4 { background-color: #9b59b6; }

/* Restore distinct backgrounds for header and footer */
.upgrading-job-card-header {
    background-color: #4a627a;
    display: flex;
    justify-content: center;
    position: relative;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #2c3e50;
}

.upgrading-job-card-body {
    padding: 15px;
    flex-grow: 1;
}

.upgrading-job-card-footer {
    background-color: rgba(0,0,0,0.2);
    border-top: 1px solid #4a627a;
    padding: 10px 15px;
    margin-top: auto;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.job-card-id {
    font-size: 1.0em;
    color: #dfdfdf;
    font-weight: bold;
}

.upgrading-job-card-body p {
    display: flex;          /* Use flexbox for columns */
    justify-content: center;  /* Center the whole line's content block */
    gap: 12px;                /* Creates the space for the vertical red line */
    align-items: baseline;    /* Aligns text baselines, useful for different font sizes */
    margin: 0 auto 10px;    /* Center the block and provide bottom margin */
    font-size: 0.9em;
    max-width: 90%;         /* Prevent the line from being too wide on large cards */
}

/* The "Label:" part */
.upgrading-job-card-body p strong {
    flex: 1;                /* Allows the label to take up available space */
    text-align: right;        /* Aligns the label text to the right */
    color: #bdc3c7;          /* Standard label color */
}

/* The "Value" part */
.upgrading-job-card-body p span {
    flex: 1;                /* Allows the value to take up available space */
    text-align: left;         /* Aligns the value text to the left */
    color: #ecf0f1;          /* Brighter color for the value */
    font-weight: bold;
}

.upgrading-job-card-body p:last-child {
    margin-bottom: 0;
}

.job-status {
    position: absolute;      /* Take the status out of the normal flow */
    left: 15px;              /* Pin it to the left side */
    top: 50%;
    transform: translateY(-50%); /* Ensure it's vertically centered */
    font-size: 0.6em;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    color: #fff;
}

.overflow-status {
    position: absolute;      /* Take the status out of the normal flow */
    right: 15px;              /* Pin it to the left side */
    top: 50%;
    transform: translateY(-50%); /* Ensure it's vertically centered */
    font-size: 0.85em;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    color: #fff;
}

.status-completed { background-color: #27ae60; }
.status-in-progress { background-color: #e67e22; }
.status-overdue { background-color: #c0392b; }

#select-starbase-message,
#no-jobs-message {
    text-align: center;
    color: #95a5a6;
    font-style: italic;
    font-size: 1.2em;
    padding: 40px 0;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.recipe-group-stats {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-block; /* Changed from flex */
    text-align: center;    /* Center the text lines */
    font-size: 0.9em;
    color: #bdc3c7;
    white-space: nowrap;
    /*background-color: #2c3e50;*/
    padding: 6px 15px;
    border-radius: 5px;
    line-height: 1.4;      /* Add spacing between the two lines */
}

/* Remove styling from individual spans within the container */
.recipe-group-stats span {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

/* Style the top line (Projected amount) to be more prominent */
.stats-expected {
    font-size: 1.1em;
    font-weight: bold;
    color: #ecf0f1; /* Brighter color for the number */
}

/* Style for the "in X time" text */
.stats-expected-time {
    font-size: 1.0em; /* Slightly smaller than the projected number */
    font-weight: normal;
    color: #bdc3c7; /* Standard text color */
}

.stats-separator {
    color: #7f8c8d; /* Muted color for separators */
    font-weight: bold;
}

/* Style for the projected total when it overflows */
.stats-expected.projected-overflow {
    color: #e74c3c;
    font-weight: bold;
}

/* Red highlight for job cards that will overflow the required amount */
.upgrading-job-card.overflow {
    border-color: #e74c3c !important; /* !important overrides tier colors */
    border-width: 1px 1px 1px 5px;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
}
.upgrading-job-card.overflow .upgrading-job-card-header {
    background-color: #8c535f; /* A more saturated red for the header */
}


/* Minor tweak to ensure status class names are consistent */
.job-status.status-in-progress { background-color: #e67e22; }
.job-status.status-completed { background-color: #27ae60; }
.job-status.status-ready { background-color: #27ae60; }
.overflow-status.status-overflow { background-color: #d51800;}


#color-legend-container {
    flex: 1 1 auto; /* Allow the legend to take the remaining space */
    border: 1px solid #4a627a;
    border-radius: 6px;
    padding: 10px 15px;
    background-color: rgba(0,0,0,0.1);
}

.legend-title {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    font-weight: bold;
    color: #1abc9c;
    text-align: center;
    border-bottom: 1px solid #4a627a;
    padding-bottom: 8px;
}

.legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 15px;
}

.legend-list li {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: #bdc3c7;
}

.legend-color-box {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    margin-right: 8px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Colors to match the job card border tiers */
.legend-color-box.tier-1 { background-color: #3498db; }
.legend-color-box.tier-2 { background-color: #2ecc71; }
.legend-color-box.tier-3 { background-color: #f39c12; }
.legend-color-box.tier-4 { background-color: #9b59b6; }
.legend-color-box.overflow { background-color: #e74c3c; }

.stacked-toggle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

/* For the row of toggles in the transport selector */
.transport-toggles-wrapper {
    display: flex;
    justify-content: space-around;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.capacity-info-row {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
}

/* Style for each capacity item (Cargo, Fuel, Ammo) */
.capacity-info-row .consumption-item {
    display: flex;
    justify-content: center; /* Center content vertically */
    align-items: center;
    flex-direction: column; /* Stack label and value vertically */
    gap: 4px;              /* Space between label and value */
    width: 90px; /* Give each item a fixed width for perfect alignment */
    flex-basis: 30%;       /* Give each item a base width */
    line-height: 1.2;
}

/* Style for the capacity labels ("Cargo", "Fuel", "Ammo") */
.capacity-info-row .consumption-item span {
    font-size: 0.8em;
    color: #a0aec0;        /* Lighter gray for the label */
    text-transform: uppercase;
    font-weight: 600;
}

/* Style for the capacity values */
.capacity-info-row .consumption-item strong {
    font-size: 1.1em;
    color: #ffffff;
    font-weight: 600;
}

/* For aligning footer labels and values */
.selection-card-footer .footer-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 2px 5px;
}

.fleet-selector-popup .fleet-selector-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.sticky-controls-header {
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 0; /* Sticks to the top of the scrolling container (.fleet-selector-content) */
    z-index: 10;

    background-color: #2c3e50;

    padding: 15px 10px;
    border-bottom: 1px solid #4a627a;
}

.sticky-controls-header .transport-selector-controls {
    padding-top: 15px;
}

.mining-controls-wrapper {
    display: flex;
    flex-wrap: wrap; /* Allow controls to wrap on smaller screens */
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.mining-controls-wrapper .detail-field {
    margin-bottom: 0; /* Remove bottom margin as gap is used */
    display: flex;
    align-items: center;
    gap: 8px;
}

.mining-controls-wrapper .detail-field label {
    margin-bottom: 0;
    white-space: nowrap;
}

.mining-controls-wrapper .full-craft-toggle-container {
    /*flex-direction: row; /* Keep toggle side-by-side with label */
    gap: 8px;
    display: grid;
    justify-content: center;
}

.transport-controls-wrapper {
    display: flex;
    justify-content: space-between; /* This pushes the two groups to opposite ends */
    align-items: flex-end; /* Aligns the groups along their bottom edge */
    width: 100%;
}

/* Container for the dropdowns and input fields on the left */
.transport-dropdowns-group {
    display: flex;
    align-items: flex-end;
    gap: 20px; /* Space between the input fields */
}

/* Container for the toggle buttons on the right */
.transport-toggles-group {
    display: flex;
    align-items: center;
    gap: 25px; /* Space between the toggle buttons */
}

/* --- Styles for Smart Transport Detail Popup --- */
.smart-routes-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.smart-route-item {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid #4a627a;
    border-radius: 8px;
    padding: 15px;
}

.smart-route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #4a627a;
    cursor: pointer; /* Indicate the header is clickable */
    position: relative; /* For positioning the indicator */
    gap: 15px; /* Adds space between header elements */
    padding: 10px 15px; /* Add some padding */

}

.smart-route-header h3 {
    flex-grow: 1;
    text-align: center;
    margin: 0;
    color: #3498db;
}

.route-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.route-controls span {
    font-weight: bold;
    font-size: 1.2em;
}

.route-controls select {
    flex: 1; /* Allow dropdowns to grow */
}

/* Master buttons at the bottom */
.smart-transport-master-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}
.smart-transport-master-controls .add-cargo-btn {
    flex: 1;
}

.r4-balance-btn {
    background-color: #8e44ad !important; /* A nice purple */
}
.r4-balance-btn:hover {
    background-color: #732d91 !important;
}
.r4-balance-btn:disabled {
    background-color: #5a5a5a !important;
    cursor: not-allowed;
}

.route-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.route-controls > select {
    flex: 1; /* Allow dropdowns to grow */
}

.route-controls > span {
    font-weight: bold;
    font-size: 1.5em;
}

/* New container for the two warp toggles */
.route-warp-toggles {
    display: flex;
    gap: 20px; /* Space between the two toggles */
    border-left: 2px solid #4a627a;
    padding-left: 20px;
    margin-left: 10px;
    font-size: 0.8em;
}
.route-stats {
    display: flex;
    justify-content: space-evenly;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #4a627a;
    background-color: rgba(0,0,0,0.1);
}

.route-stat-item {
    text-align: center;
}

.route-stat-item span {
    font-size: 0.8em;
    color: #bdc3c7;
    text-transform: uppercase;
}

.route-stat-item strong {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
}

.warning-text {
    color: #e74c3c;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
}

/* --- New styles for Smart Transport route editor --- */
.route-manifests-container {
    display: flex;
    gap: 15px;
    width: 100%;
}

.route-manifests-container .detail-cargo-section {
    flex: 1; /* Each cargo section takes up half the space */
    margin-bottom: 0; /* Remove bottom margin as it's handled by parent gap */
}

.smart-route-item.collapsed .collapse-indicator-smart-transport {
    transform: rotate(-90deg);
}

.smart-route-body {
    display: grid;
    grid-template-rows: 1fr; /* Start in expanded state */
    transition: grid-template-rows 0.4s ease-in-out;
}

.smart-route-item.collapsed .smart-route-body {
    grid-template-rows: 0fr; /* Collapse to 0 height */
}

.smart-route-body > div {
    overflow: hidden; /* This is crucial for the animation to work correctly */
}

#fleet-detail-popup.smart-transport-detail {
    max-width: 1000px;
}

.smart-route-item.route-over-time {
    border-color: #e74c3c; /* A distinct red border */
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
}

/* General styling for the popup's content area */
.welcome-popup-content {
    padding: 10px 25px 25px 25px; /* Add more padding */
    line-height: 1.6; /* More breathable text */
    font-size: 16px;  /* A comfortable base font size */
}

/* Welcome Header */
.welcome-popup-content h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 600;
    color: #ffffff;
}

/* "Standard Account" status message */
.status-message {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #d0d0d0;
}

/* Highlight the "Standard" text */
.status-message strong {
    color: #FFC107; /* Yellow for Standard status */
    font-weight: 600;
}

/* Subtle horizontal line separator */
.separator {
    border: none;
    height: 1px;
    background-color: #444;
    margin: 25px 0;
}

/* Section for calls to action */
.cta-section {
    text-align: center;
    margin: 20px 0;
}

.cta-section p {
    margin: 10px 0;
}

/* General link styling within the popup */
.welcome-popup-content a {
    color: #76a9fa; /* A pleasant blue for links */
    text-decoration: none;
    font-weight: 600;
}

.welcome-popup-content a:hover {
    text-decoration: underline;
}

/* Smaller, less important informational text */
.subtle-text {
    font-size: 0.9em;
    color: #999;
    margin-top: 15px;
}