/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
    --primary: #021774;
    --primary-dark: #01103d;
    --primary-light: #e8eaf5;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 50%, var(--primary-light) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-800);
    line-height: 1.6;
}

.upload-container {
    width: 100%;
    max-width: 540px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.upload-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--primary-light);
    border-radius: 50%;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gray-50);
}

.drop-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.02);
}

.drop-zone-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.drop-zone-content p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.upload-icon {
    color: var(--gray-400);
    transition: color 0.3s ease, transform 0.3s ease;
}

.drop-zone:hover .upload-icon,
.drop-zone.drag-over .upload-icon {
    color: var(--primary);
    transform: translateY(-4px);
}

.file-requirements {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
}

/* File Preview */
.file-preview {
    margin-top: 1.5rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 8px;
    color: var(--primary);
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: var(--error-light);
    color: var(--error);
}

.upload-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.upload-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.upload-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-container {
    margin-top: 1.5rem;
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 100px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
}

/* Success Result */
.success-result {
    text-align: center;
    padding: 1.5rem 0;
}

.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--success-light);
    border-radius: 50%;
    color: var(--success);
    margin-bottom: 1rem;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-result h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.success-message {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.url-container {
    text-align: left;
    margin-bottom: 1.5rem;
}

.url-container label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.url-input-group {
    display: flex;
    gap: 0.5rem;
}

.url-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--gray-700);
    background: var(--gray-50);
    min-width: 0;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--gray-800);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--gray-900);
}

.copy-btn.copied {
    background: var(--success);
}

.copy-feedback {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-another-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-another-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--error-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    margin-top: 1rem;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.error-icon {
    color: var(--error);
    flex-shrink: 0;
}

.error-message span {
    flex: 1;
    color: var(--error);
    font-weight: 500;
}

.dismiss-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--error);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.dismiss-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 1rem;
    }
    
    .upload-container {
        padding: 1.5rem;
    }
    
    .drop-zone {
        padding: 2rem 1rem;
    }
    
    .url-input-group {
        flex-direction: column;
    }
    
    .copy-btn {
        justify-content: center;
    }
}
