/* Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

/* Theme Toggle Button - Legacy (for pages without top-nav) */
.container > .theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s;
    z-index: 100;
}

.container > .theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.container > .theme-toggle .icon-sun,
.container > .theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s, transform 0.3s;
}

.container > .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .container > .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .container > .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

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

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

/* Header */
header {
    text-align: center;
    padding: 40px 0 30px;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text);
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Progress Steps */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin: 40px 0;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.step.active .step-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.step.completed .step-number {
    background: var(--success);
    color: white;
}

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

.step.active .step-label {
    color: var(--primary);
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text);
}

.info-text {
    color: var(--text-light);
    margin-bottom: 24px;
}

.text-center {
    text-align: center;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.upload-area p {
    color: var(--text-light);
    margin-bottom: 16px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

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

#progressText {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Success Message */
.success-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.success-message .icon {
    font-size: 1.5rem;
}

/* Buttons */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
    background: var(--text);
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
}

/* Alternatives */
#alternativesContainer {
    display: grid;
    gap: 16px;
}

.alternative-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
}

.alternative-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.alternative-card.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.alternative-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.alternative-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.alternative-focus {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.alternative-summary {
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.6;
}

.alternative-scores {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.score-item {
    flex: 1;
    text-align: center;
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.score-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

/* Field Sections */
.field-sections {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.field-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.field-item {
    margin-bottom: 20px;
}

.field-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: block;
}

.field-input, .field-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--card-bg);
    color: var(--text);
}

.field-input:focus, .field-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-textarea {
    min-height: 100px;
    resize: vertical;
    overflow-y: hidden;
    field-sizing: content;
}

/* Auto-resize textarea fallback */
.field-textarea.auto-resize {
    overflow-y: hidden;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 40px 0;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 12px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

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

/* Success Icon */
.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loadingText {
    color: white;
    font-size: 1.1rem;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .progress-steps {
        font-size: 0.85rem;
    }

    .step-label {
        font-size: 0.8rem;
    }

    .alternative-scores {
        flex-direction: column;
        gap: 12px;
    }

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