/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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: 1200px;
    margin: 0 auto;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.95;
    font-weight: 400;
}

/* Main Content */
.main-content {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    margin-bottom: 2rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

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

.upload-area {
    position: relative;
    border: 3px dashed var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--bg-color);
    transition: var(--transition);
    cursor: pointer;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #ede9fe;
    border-style: solid;
}

.upload-area.has-file {
    border-color: var(--success-color);
    border-style: solid;
    background: #f0fdf4;
}

.upload-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

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

.supported-formats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.browse-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.browse-btn:active {
    transform: translateY(0);
}

/* File Info Display */
.file-info {
    width: 100%;
    position: relative;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.image-preview {
    width: 100%;
    max-width: 200px;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--error-color);
    color: white;
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* File List Section */
.file-list-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 0.75rem;
}

.file-list-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.file-list-container {
    overflow-x: auto;
}

.file-list-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.file-list-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.file-list-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-list-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.file-list-table tbody tr:last-child td {
    border-bottom: none;
}

.file-list-table tbody tr:hover {
    background: var(--bg-color);
}

.file-name-cell {
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
    max-width: 300px;
}

.file-size-cell {
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.file-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.file-status.pending {
    background: #f3f4f6;
    color: #6b7280;
}

.file-status.processing {
    background: #dbeafe;
    color: #1e40af;
}

.file-status.complete {
    background: #d1fae5;
    color: #065f46;
}

.file-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.file-status-icon {
    font-size: 1rem;
}

.file-action-btn {
    background: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.file-action-btn:hover {
    background: var(--error-color);
    color: white;
}

.file-action-btn.download {
    color: var(--success-color);
    border-color: var(--success-color);
}

.file-action-btn.download:hover {
    background: var(--success-color);
    color: white;
}

.files-count {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Action Section */
.action-section {
    text-align: center;
    margin-top: 2rem;
}

.process-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
}

.process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.process-btn:active:not(:disabled) {
    transform: translateY(0);
}

.process-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.process-btn.processing {
    background: var(--warning-color);
    cursor: wait;
}

/* Progress Section */
.progress-section {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-color);
    border-radius: 0.75rem;
}

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

.progress-bar {
    width: 100%;
    height: 1rem;
    background: var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 0.5rem;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Status Section */
.status-section {
    margin: 2rem 0;
}

.status-message {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    text-align: center;
}

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

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

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* Download Section */
.download-section {
    margin: 2rem 0;
}

.download-card {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.success-icon {
    width: 4rem;
    height: 4rem;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-md);
}

.download-card h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.download-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.download-summary {
    background: rgba(255, 255, 255, 0.7);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.download-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.download-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.download-all-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.download-all-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #0891b2 100%);
}

.individual-downloads {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.individual-download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.individual-download-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.individual-download-item:last-child {
    margin-bottom: 0;
}

.download-file-name {
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    flex: 1;
    margin-right: 1rem;
    word-break: break-word;
}

.download-file-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.download-file-btn:hover {
    background: #059669;
    transform: scale(1.05);
}

.reset-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 0.75rem 2rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 1rem;
}

.reset-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Instructions Section */
.instructions-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.instructions-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.instruction-card {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--bg-color);
    border-radius: 1rem;
    transition: var(--transition);
}

.instruction-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.instruction-number {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.instruction-card h4 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.instruction-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.info-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 1.5rem;
    border-radius: 1rem;
    border-left: 4px solid var(--warning-color);
    margin-top: 2rem;
}

.info-box h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.info-box p {
    color: var(--text-secondary);
    margin: 0;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 1.5rem;
    opacity: 0.9;
}

.footer p {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .upload-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .upload-area {
        padding: 2rem 1rem;
        min-height: 280px;
    }

    .process-btn {
        width: 100%;
        padding: 1rem 2rem;
    }

    .file-list-section {
        padding: 1rem;
    }

    .file-list-table {
        font-size: 0.875rem;
    }

    .file-list-table th,
    .file-list-table td {
        padding: 0.75rem 0.5rem;
    }

    .file-name-cell {
        max-width: 150px;
        font-size: 0.875rem;
    }

    .file-status {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .file-action-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .download-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .download-btn,
    .reset-btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
    }

    .individual-download-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .download-file-name {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .download-file-btn {
        width: 100%;
    }

    .instructions-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }

    .upload-area h3 {
        font-size: 1.25rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

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

.spinning {
    animation: spin 1s linear infinite;
}
