/* Modern Professional Stylesheet */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #475569;
    --success: #059669;
    --error: #dc2626;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

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

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

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 400;
}

.upload-section,
.progress-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
}

.upload-section {
    border: 2px solid var(--border);
}

.upload-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-section p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.warning-text {
    color: #d97706;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

/* Form Styling */
input[type="password"],
input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

input[type="password"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
    max-height: 200px;
    overflow: visible;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

input[type="file"] {
    display: none;
}

.file-label {
    display: inline-block;
    background: var(--background);
    border: 2px solid var(--border);
    padding: 0.875rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.file-label:hover:not([style*="not-allowed"]) {
    border-color: var(--primary);
    background: white;
}

#file-name {
    display: inline-block;
    margin-left: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

button {
    background: var(--primary);
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 400px;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.button-group button,
.button-group .download-btn {
    margin-top: 0;
    flex: 1 1 auto;
    min-width: 200px;
}

.button-group .download-btn {
    max-width: 400px;
}

button:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

button:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* Progress Section */
.progress-section {
    display: none;
}

.progress-section.active {
    display: block;
}

.progress-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

#progress-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

#current-product {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 0.75rem;
    background: var(--background);
    border-radius: 9999px;
    overflow: hidden;
    margin: 1rem 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    min-width: 5%;
    border-radius: 9999px;
}

.progress-fill.processing {
    background: linear-gradient(90deg, 
        var(--primary) 0%, 
        #60a5fa 50%, 
        var(--primary) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

#stats-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

#stats-section p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

/* Status Messages */
.status-message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--error);
}

/* Download Button */
.download-btn {
    display: inline-block;
    background: var(--success);
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-align: center;
    white-space: nowrap;
}

.download-btn:hover {
    background: #047857;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
    }
    
    .upload-section,
    .progress-section {
        padding: 1.5rem;
        border-radius: 0.75rem;
    }
    
    header {
        margin-bottom: 2rem;
    }
    
    button,
    input[type="password"],
    input[type="text"] {
        max-width: 100%;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button,
    .button-group .download-btn {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
    }
    
    #file-name {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    #stats-section p {
        font-size: 0.75rem;
        overflow-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .file-label {
        width: 100%;
        text-align: center;
    }
}
