:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #f9fafb;
    --card-bg: white;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* File Info */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 4px;
}

.info-label {
    font-weight: 600;
    color: var(--text-light);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg);
}

th {
    text-align: left;
    padding: 0.75rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Progress Bar */
.progress-bar {
    height: 24px;
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 12px;
    transition: width 0.3s ease;
    width: 0;
}

#progressText {
    text-align: center;
    color: var(--text-light);
    margin: 1rem 0;
}

.progress-log {
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
}

.progress-log-entry {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.progress-log-entry.success {
    color: var(--success);
}

.progress-log-entry.error {
    color: var(--error);
}

.progress-log-entry.processing {
    color: var(--primary);
    font-style: italic;
    opacity: 0.9;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.5; }
}

/* Results Summary */
.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.summary-item {
    text-align: center;
    padding: 1.5rem;
    border-radius: 8px;
}

.summary-item.success {
    background: rgba(16, 185, 129, 0.1);
}

.summary-item.error {
    background: rgba(239, 68, 68, 0.1);
}

.summary-item.total {
    background: rgba(99, 102, 241, 0.1);
}

.summary-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.summary-item.success .summary-number {
    color: var(--success);
}

.summary-item.error .summary-number {
    color: var(--error);
}

.summary-item.total .summary-number {
    color: var(--primary);
}

.summary-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.results-actions {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

/* Results Table */
.results-table-wrapper {
    overflow-x: auto;
    margin-top: 2rem;
}

#resultsTable td {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#resultsTable td:hover {
    white-space: normal;
    word-break: break-word;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    section {
        padding: 1.5rem;
    }

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

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

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Auth Modal */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.auth-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-modal h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

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

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    color: #333333;
}

.auth-modal .error-message {
    color: #dc2626;
    background: #fee2e2;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.auth-modal .btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.logout-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.3s;
}

.logout-btn:hover {
    opacity: 0.9;
}

header {
    position: relative;
}

/* History Section */
.history-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.history-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.history-content {
    min-height: 200px;
}

.history-item {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-item-info {
    flex: 1;
}

.history-item-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.history-item-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
}

.history-item-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.job-item {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary);
}

.job-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.job-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.job-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}
