body {
    font-family: Arial, sans-serif;
    background-color: #121212; /* Dark background */
    color: #e0e0e0; /* Light text */
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    background-color: #1e1e1e; /* Slightly lighter surface */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    padding: 30px;
    width: 100%;
    max-width: 900px;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #9b59b6; /* Purple accent */
    margin-bottom: 10px;
}

h2, h3 {
    color: #e0e0e0;
    margin-top: 20px;
    margin-bottom: 15px;
}

/* Tabs Navigation */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
}

.tab-button {
    padding: 12px 20px;
    text-decoration: none;
    color: #e0e0e0;
    background-color: #2a2a2a;
    border: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 5px;
    font-weight: bold;
}

.tab-button:hover:not(.disabled) {
    background-color: #3a3a3a;
}

.tab-button.active {
    background-color: #9b59b6; /* Purple accent for active tab */
    color: #ffffff;
}

.tab-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tab Content */
.tab-panel {
    display: none;
    padding: 20px 0;
}

.tab-panel.active {
    display: block;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.manual-char-inputs {
    display: flex;
    flex-wrap: nowrap; /* Ensure they stay in one row */
    gap: 15px;
    align-items: flex-end; /* Align labels at the bottom */
}

.manual-char-inputs > div {
    flex: 1; /* Distribute space evenly */
    min-width: 150px; /* Minimum width for each input group */
    display: flex;
    flex-direction: column;
}

.manual-char-inputs label {
    margin-bottom: 5px;
}

.manual-char-inputs input[type="text"],
.manual-char-inputs input[type="number"] {
    width: 100%;
    box-sizing: border-box;
}

label {
    font-weight: bold;
    color: #e0e0e0;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #333;
    color: #e0e0e0;
    resize: vertical;
    box-sizing: border-box;
}

textarea:focus {
    outline: none;
    border-color: #9b59b6;
    box-shadow: 0 0 5px rgba(155, 89, 182, 0.5);
}

button {
    padding: 12px 20px;
    background-color: #9b59b6; /* Purple accent */
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

button:hover:not(:disabled) {
    background-color: #8e44ad; /* Darker purple on hover */
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* Character Manager - Drop Zone */
.drop-zone {
    border: 2px dashed #9b59b6;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.drop-zone:hover {
    background-color: #2a2a2a;
}

.drop-zone p {
    margin: 0;
    color: #e0e0e0;
}

/* Uploaded Characters List */
#characterList {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

#characterList li {
    background-color: #2a2a2a;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow items to wrap if space is limited */
}

.character-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px; /* Space between items */
}

.character-item span {
    flex-shrink: 0; /* Prevent shrinking */
}

.character-item .delete-char-btn {
    margin-left: auto; /* Push delete button to the right */
}

.character-item strong {
    color: #9b59b6; /* Purple accent for labels */
}

.delete-char-btn {
    background-color: #e74c3c; /* Red for delete */
    padding: 8px 12px;
    font-size: 14px;
}

.delete-char-btn:hover {
    background-color: #c0392b;
}

/* Results Section */
.results-section {
    background-color: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.results-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
}

.results-tab-button {
    padding: 10px 15px;
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    margin-right: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.results-tab-button:hover {
    background-color: #4a4a4a;
}

.results-tab-button.active {
    background-color: #9b59b6;
    color: #ffffff;
}

.results-panel {
    display: none;
    padding-top: 10px;
}

.results-panel.active {
    display: block;
}

.results-panel ul {
    list-style: disc;
    margin-left: 20px;
    padding: 0;
}

.results-panel li {
    margin-bottom: 5px;
}

.session-entry {
    border-bottom: 1px dashed #555;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.session-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.character-io-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.character-io-buttons .button {
    padding: 12px 20px;
    background-color: #9b59b6; /* Purple accent */
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-decoration: none; /* For label acting as button */
    display: inline-block; /* For label acting as button */
    text-align: center; /* For label acting as button */
}

.character-io-buttons .button:hover {
    background-color: #8e44ad; /* Darker purple on hover */
}

.export-button {
    width: auto;
    align-self: flex-end;
    margin-top: 20px;
}

/* Error Banner */
.error-banner {
    background-color: #e74c3c;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none; /* Hidden by default */
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #9b59b6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
