/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #5855e0;
    --success-color: #10b981;
    --success-hover: #059669;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --secondary-color: #6b7280;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Section Styles */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.file-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.file-upload-item {
    position: relative;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
    height: 160px;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
    transform: translateY(-2px);
}

.file-label.has-file {
    border-color: var(--success-color);
    background: #f0fdf4;
}

.file-label i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.file-label.has-file i {
    color: var(--success-color);
}

.label-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.label-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.file-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--surface-color);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.file-info.has-file {
    color: var(--success-color);
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Button Styles */
.btn-primary,
.btn-secondary,
.btn-success {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    user-select: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Loading Section */
.loading-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: #f3f4f6;
    border-radius: 3px;
    margin: 1.5rem auto 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 3px;
    width: 0%;
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Results Section */
.results-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.report-container {
    max-height: 800px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
}

.report-content {
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Scrollbar Styling */
.report-container::-webkit-scrollbar {
    width: 8px;
}

.report-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.report-container::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.report-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* Error Section */
.error-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 2px solid #fecaca;
}

.error-content i {
    font-size: 3rem;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-content h3 {
    font-size: 1.5rem;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    margin-bottom: 1rem;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.api-status i {
    font-size: 0.8rem;
}

.api-status.online i {
    color: var(--success-color);
}

.api-status.offline i {
    color: var(--error-color);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast i {
    font-size: 1.2rem;
}

.toast.success i {
    color: var(--success-color);
}

.toast.error i {
    color: var(--error-color);
}

.toast.warning i {
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .upload-section {
        padding: 1.5rem 1rem;
    }

    .file-upload-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .file-label {
        height: 140px;
        padding: 1.5rem 1rem;
    }

    .form-actions {
        flex-direction: column;
        align-items: center;
    }

    .result-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn-primary,
    .btn-secondary,
    .btn-success {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .toast {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.75rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .file-label {
        height: 120px;
        padding: 1rem;
    }

    .file-label i {
        font-size: 2rem;
    }
}

/* Print Styles */
@media print {
    .upload-section,
    .loading-section,
    .error-section,
    .result-actions,
    .header,
    .footer {
        display: none !important;
    }

    .results-section {
        box-shadow: none;
        border: none;
        max-height: none;
        overflow: visible;
    }

    .report-container {
        max-height: none;
        overflow: visible;
    }
}