:root {
    --primary-color: #7e4a35;
    --secondary-color: #82b74b;
    --accent-color: #c1946a;
    --background-color: #f8f5e6;
    --text-color: #3a3a3a;
    --border-radius: 8px;
    --box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

h1, h2, h3 {
    color: var(--primary-color);
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 10px;
}

h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.two-column-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}

.column {
    flex: 1;
    min-width: 300px;
}

.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
}

.divider-text {
    background-color: #8a663a; /* Slightly more golden brown like in screenshot */
    color: white;
    font-weight: bold;
    padding: 0;
    border-radius: 50%;
    box-shadow: var(--box-shadow);
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    overflow: hidden;
}

.divider-text:hover {
    transform: scale(1.1);
    background-color: var(--secondary-color);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.upload-section, .legacy-section, .character-section, .result-section {
    background-color: #f0f0f0;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.column-header {
    height: 80px;
    margin-bottom: 15px;
}

.column-header h2, 
.character-section .column-header h2, 
.result-section .column-header h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.column-header p, 
.character-section .column-header p, 
.result-section .column-header p {
    margin: 0;
    color: var(--text-color);
    opacity: 0.8;
}



.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px dashed var(--accent-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    height: 200px;
    box-sizing: border-box;
    position: relative;
}

.file-upload.dragover {
    background-color: rgba(193, 148, 106, 0.2);
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.file-upload p {
    margin: 0;
}

.file-upload-btn {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 1;
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 2px solid var(--accent-color);
    border-radius: var(--border-radius);
    font-family: monospace;
    resize: none;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.6);
}

#instructions, .instructions {
    margin-top: 10px;
    min-height: 50px;
}

/* Ensure the copy button is hidden by default but shown after processing */
#legacy-section .download-button {
    margin-top: 10px;
}

/* The main definition of character-section is now unified with result-section */

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.character-card {
    border: 2px solid var(--accent-color);
    border-radius: var(--border-radius);
    padding: 15px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.character-card.selected {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.character-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.character-card.host-character {
    cursor: default;
    opacity: 0.8;
    border-color: #ddd;
}

.character-card.host-character::after {
    content: "Current Host";
    position: absolute;
    top: -10px;
    right: 10px;
    background-color: var(--secondary-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.character-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.character-type {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.character-card.selected .character-type {
    color: #f0f0f0;
}

.swap-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: block;
    margin: 20px auto;
    width: fit-content;
    text-align: center;
    transition: background-color 0.3s, transform 0.3s;
}

.swap-button:hover {
    background-color: #71a03d;
    transform: translateY(-2px);
}

.swap-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.result-section, .character-section {
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 30px;
    margin-bottom: 30px;
    background-color: #f0f0f0;
}

.result-section .column-header, 
.character-section .column-header {
    height: 80px;
    margin-bottom: 15px;
}

.result-section:empty {
    display: none;
}

.empty-state {
    width: 100%;
    padding: 40px 20px;
    text-align: center;
    background-color: #f7f7f7;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    color: #888;
    font-style: italic;
}

.download-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.download-button::before {
    content: "📥 ";
    margin-right: 8px;
}

.download-button:hover {
    background-color: #6a3f2e;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.download-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

/* Copy section styles */
.result-divider {
    width: 100%;
    margin: 30px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 56px;
}

.result-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #d3c3ad; /* Lighter color to match screenshot */
    z-index: 1;
    opacity: 1;
}

.copy-section {
    margin-top: 20px;
    padding-top: 10px;
}

.file-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-button {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background-color: #e0e0e0;
}

.tab-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-pane {
    display: none;
}

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

.copy-textarea {
    width: 100%;
    height: 150px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: #f9f9f9;
    font-family: monospace;
    font-size: 0.9rem;
}

.copy-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-button:hover {
    background-color: var(--primary-color);
}

.copy-button::before {
    content: "📋 ";
    margin-right: 5px;
}

.copy-instructions {
    margin-top: 15px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.error {
    color: red;
    font-weight: bold;
    padding: 10px;
    background-color: #ffeeee;
    border-radius: var(--border-radius);
    margin: 10px 0;
}

.success {
    color: green;
    font-weight: bold;
    padding: 10px;
    background-color: #eeffee;
    border-radius: var(--border-radius);
    margin: 10px 0;
}

.info {
    color: #0066cc;
    font-weight: bold;
    padding: 10px;
    background-color: #e6f2ff;
    border-radius: var(--border-radius);
    margin: 10px 0;
    border-left: 4px solid #0066cc;
}

.issues-section {
    margin-top: 30px;
    font-size: 0.9rem;
}

.issues-section h3 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 5px;
}

.issues-section ul {
    padding-left: 20px;
}

.issues-section li {
    margin-bottom: 5px;
}

footer {
    margin-top: 50px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    padding: 20px 0;
    border-top: 1px solid #ddd;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

#message-container {
    margin: 15px 0;
    min-height: 20px;
}

#message-container div {
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

/* Ensure all buttons have a consistent appearance */
.download-button {
    display: inline-block;
    text-align: center;
    font-weight: 600;
}

.swap-button {
    display: block;
    margin: 20px auto;
    text-align: center;
    font-weight: 600;
    width: fit-content;
}

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

/* Responsive styles for the OR divider */
@media (max-width: 768px) {
    .section-divider,
    .result-divider {
        width: 100%;
        margin: 30px 0;
        height: 56px;
    }
    
    /* Remove the additional lines on mobile since we now have a full line */
    .divider-text::before,
    .divider-text::after {
        display: none;
    }
}
