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

:root {
    --primary-dark: #050B29;
    --primary-blue: #275BA8;
    --primary-blue-light: #4A7BC7;
    --accent-green: #4CAF50;
    --success: #27ae60;
    --error: #e74c3c;
    --text-primary: #050B29;
    --text-secondary: #6c757d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-light: #e9ecef;
    --shadow-sm: 0 2px 4px rgba(5, 11, 41, 0.08);
    --shadow-md: 0 4px 12px rgba(5, 11, 41, 0.12);
    --shadow-lg: 0 8px 24px rgba(5, 11, 41, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px;
    background: var(--primary-dark);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.logo-container {
    margin-bottom: 20px;
}

.logo {
    height: 60px;
    width: auto;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
    letter-spacing: -0.5px;
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.version {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Navigation */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.nav-links a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 2px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-blue);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-blue-light);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Form Styles */
.upload-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.upload-section h2 {
    color: var(--primary-dark);
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 400;
}

.upload-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.label-text {
    font-size: 0.95rem;
}

.required {
    color: var(--error);
    margin-left: 4px;
}

.optional {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: 8px;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus,
input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(39, 91, 168, 0.1);
}

/* Module Selector */
.module-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-top: 10px;
}

.module-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.module-checkbox:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.module-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.module-checkbox label {
    cursor: pointer;
    margin-bottom: 0;
    font-weight: 400;
    color: var(--text-primary);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-blue);
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-blue-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

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

/* Progress Section */
.progress-section {
    margin-bottom: 30px;
}

.progress-wrapper {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--primary-blue);
}

.progress-wrapper h3 {
    color: var(--primary-dark);
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 400;
}

.progress-bar-container {
    background: var(--bg-light);
    border-radius: 25px;
    height: 35px;
    overflow: hidden;
    margin-bottom: 25px;
    border: 1px solid var(--border-light);
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-blue-light));
    height: 100%;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
}

.progress-text {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.stage-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.current-stage, .time-estimate {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.stage-icon::before {
    content: '▶';
    color: var(--primary-blue);
    font-weight: bold;
}

.time-icon::before {
    content: '⏱';
    color: var(--primary-blue);
}

.progress-status {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-status.degraded {
    color: #c27b00;
}

.module-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.module-progress-placeholder {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-light);
    color: var(--text-secondary);
    text-align: center;
}

.module-progress-item {
    padding: 14px 16px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.module-progress-item.active {
    border-color: var(--primary-blue-light);
    box-shadow: var(--shadow-md);
}

.stage-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 8px;
}

.stage-row-header .stage-icon {
    margin-right: 8px;
}

.stage-row-bar {
    position: relative;
    height: 8px;
    background: var(--bg-light);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.stage-row-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--primary-blue);
    transition: width 0.4s ease;
}

.module-progress-item.active .stage-row-fill {
    background: var(--accent-green);
}

.stage-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stage-weight {
    font-weight: 500;
}

/* Results Section */
.results-section {
    margin-bottom: 30px;
}

.results-wrapper {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.results-wrapper h3 {
    color: var(--success);
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: 400;
}

.job-info {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-blue);
}

.job-info p {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.job-info code {
    background: var(--primary-dark);
    color: white !important;  /* Force white text */
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    display: inline-block;  /* Ensure proper rendering */
    min-width: 50px;  /* Minimum width to show content */
}

/* Specific fix for job-id element */
#job-id {
    color: white !important;
    background-color: #2c3e50 !important;  /* Ensure contrasting background */
    padding: 4px 8px !important;
    display: inline-block !important;
    min-width: 200px !important;  /* Ensure enough space for UUID */
    text-align: center;
}

/* Download Section */
.download-section h4 {
    color: var(--primary-dark);
    margin-bottom: 20px;
    font-weight: 400;
}

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

.download-card {
    background: white;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
}

.download-card:hover {
    border-color: var(--primary-blue);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.download-card.primary {
    background: var(--primary-blue);
    color: white;
    border: none;
}

.download-card.primary:hover {
    background: var(--primary-blue-light);
}

.download-icon::before {
    content: '⬇';
    font-size: 1.5rem;
    color: var(--primary-blue);
}

.download-card.primary .download-icon::before {
    color: white;
}

.download-info {
    flex: 1;
}

.download-title {
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.download-card.primary .download-title {
    color: white;
}

.download-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.download-card.primary .download-desc {
    color: rgba(255, 255, 255, 0.9);
}

.download-size {
    background: var(--accent-green);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Error Section */
.error-section {
    margin-bottom: 30px;
}

.error-wrapper {
    background: white;
    border: 2px solid var(--error);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.error-wrapper h3 {
    color: var(--error);
    margin-bottom: 20px;
    font-weight: 400;
}

#error-message {
    color: var(--text-primary);
    margin-bottom: 25px;
    line-height: 1.8;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.error-actions .btn {
    min-width: 180px;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: slideIn 0.5s ease;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(39, 91, 168, 0.2);
    border-radius: 50%;
    border-top: 3px solid var(--primary-blue);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

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

    .logo {
        height: 45px;
    }

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

    .module-selector {
        grid-template-columns: 1fr;
    }

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

    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .container {
        padding: 15px;
    }

    .upload-section,
    .progress-wrapper,
    .results-wrapper {
        padding: 25px;
    }
}

/* Professional touches */
.upload-section,
.progress-wrapper,
.results-wrapper,
.error-wrapper {
    position: relative;
}

.upload-section::before,
.progress-wrapper::before,
.results-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-blue-light));
    border-radius: 4px 4px 0 0;
}

.error-wrapper::before {
    background: var(--error);
}
