/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

header .session-info {
    margin-top: 0.5rem;
    opacity: 0.8;
}

header .session-info code {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
}

/* Navigation */
nav {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .container {
    display: flex;
    gap: 2rem;
    padding: 1rem 20px;
}

nav a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: #764ba2;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 300px);
}

/* Welcome Section */
.welcome-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.welcome-section h2 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

/* Form Sections */
.form-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.form-section h3 {
    color: #333;
    margin-bottom: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.help-text {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Paste Section */
.paste-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border: 2px dashed #ddd;
}

.paste-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
}

.paste-section textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: monospace;
    margin-bottom: 1rem;
    resize: vertical;
}

.paste-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.parse-status {
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.parse-status .success {
    color: #27ae60;
    font-weight: 500;
}

.parse-status .error {
    color: #e74c3c;
    font-weight: 500;
}

.parse-status .warning {
    color: #f39c12;
    font-weight: 500;
}

.divider-text {
    text-align: center;
    color: #666;
    margin: 1.5rem 0;
    font-style: italic;
    position: relative;
}

.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.divider-text::before {
    left: 0;
}

.divider-text::after {
    right: 0;
}

/* Form Rows */
.requirement-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.character-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr 1fr auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* Form Controls */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.checkbox-group {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.checkbox-group .help-text {
    margin-left: 1.75rem;
    margin-top: 0.25rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
}

.form-group small {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Buttons */
button,
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 0.5rem 1rem;
}

.btn-remove:hover {
    background: #c0392b;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

/* Loading Indicator */
#loading-indicator {
    text-align: center;
    padding: 2rem;
    background: #f0f4ff;
    border-radius: 8px;
    margin-top: 2rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Upload Section */
.upload-section {
    border-top: 2px dashed #ddd;
    padding-top: 2rem;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.upload-box {
    display: flex;
    flex-direction: column;
}

.upload-box label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #667eea;
}

/* Results Styles */
.results-container {
    max-width: 1200px;
}

.no-results {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.no-results p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.no-results a {
    color: #667eea;
    font-weight: 500;
}

/* Results Section */
.results-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.results-section h3 {
    color: #667eea;
    margin-bottom: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* Summary Card */
.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-card h3 {
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-item .label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Tables */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.results-table th,
.results-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.results-table tr:hover {
    background: #f8f9fa;
}

.results-table.compact th,
.results-table.compact td {
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Status Badges */
.status-success {
    color: #27ae60;
    font-weight: 500;
}

.status-warning {
    color: #f39c12;
    font-weight: 500;
}

/* In Progress Section */
.in-progress-section {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
}

.in-progress-section h3 {
    color: #667eea;
    margin: 1rem 0;
}

.in-progress-section p {
    color: #666;
    margin: 0.5rem 0;
}

/* Error Section */
.error-section {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    margin: 2rem 0;
}

.error-section h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.error-section .error {
    color: #c0392b;
    background: white;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-family: monospace;
}

/* Character Assignment */
.character-assignment {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.character-assignment h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

/* Batch Info */
.batch-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.batch-info h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.batch-summary {
    background: #e8f4f8;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Fuel Analysis */
.fuel-summary {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    margin-bottom: 1rem;
}

.fuel-summary p {
    margin-bottom: 0.5rem;
}

.fuel-details {
    margin-top: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
}

.fuel-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #667eea;
    padding: 0.5rem;
    user-select: none;
}

.fuel-details summary:hover {
    background: #f8f9fa;
    border-radius: 4px;
}

.fuel-details table {
    margin-top: 1rem;
}

.selected-fuel {
    background: #e8f4f8;
    font-weight: 500;
}

.status-neutral {
    color: #95a5a6;
}

.number-cell {
    text-align: right;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
}

footer small {
    opacity: 0.8;
}

.version-info {
    font-size: 0.8rem;
    opacity: 0.7;
    font-family: monospace;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .requirement-row,
    .character-row {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        flex-direction: column;
    }

    nav .container {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Print Styles */
@media print {
    header,
    nav,
    footer,
    .form-actions,
    .export-buttons,
    button {
        display: none;
    }

    body {
        background: white;
    }

    .results-section {
        box-shadow: none;
        page-break-inside: avoid;
    }
}
