/* ============================================================================
   RESET E VARIÁVEIS
   ============================================================================ */

:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-primary-light: #818cf8;
    --color-secondary: #8b5cf6;
    --color-success: #10b981;
    --color-success-dark: #059669;
    --color-danger: #ef4444;
    --color-danger-dark: #dc2626;
    --color-warning: #f59e0b;
    
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-card: #ffffff;
    --color-text-primary: #0f172a;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;
    --color-shadow: rgba(15, 23, 42, 0.08);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ============================================================================
   TIPOGRAFIA E BODY
   ============================================================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 
                 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 32px 20px;
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   CONTAINER
   ============================================================================ */

.container {
    max-width: 900px;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   HEADER
   ============================================================================ */

header {
    text-align: center;
    margin-bottom: 48px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   UPLOAD SECTION
   ============================================================================ */

.upload-section {
    background: var(--color-bg-card);
    border-radius: var(--radius-2xl);
    padding: 48px;
    box-shadow: var(--shadow-2xl);
    margin-bottom: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.upload-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.upload-section:hover::before {
    opacity: 1;
}

/* ============================================================================
   FILE INPUT
   ============================================================================ */

.file-input-wrapper {
    margin-bottom: 24px;
}

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

.file-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    border: none;
    position: relative;
    overflow: hidden;
}

.file-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.file-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(99, 102, 241, 0.5);
}

.file-label:hover::before {
    left: 100%;
}

.file-label:active {
    transform: translateY(0);
}

/* ============================================================================
   SELECTED FILE
   ============================================================================ */

.selected-file {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--color-border);
    animation: slideInRight 0.4s ease-out;
    transition: all var(--transition-base);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.selected-file:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.file-name {
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
    margin-right: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 16px;
    padding: 4px 12px;
    background: white;
    border-radius: var(--radius-sm);
}

.btn-clear {
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.125rem;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.btn-clear:hover {
    background: var(--color-danger-dark);
    transform: rotate(90deg) scale(1.1);
}

.btn-clear:active {
    transform: rotate(90deg) scale(0.95);
}

/* ============================================================================
   UPLOAD BUTTON
   ============================================================================ */

.btn-upload {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.0625rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-upload::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(16, 185, 129, 0.5);
}

.btn-upload:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

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

.btn-upload:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

/* ============================================================================
   ERROR MESSAGE
   ============================================================================ */

.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: var(--color-danger-dark);
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    margin-top: 24px;
    border-left: 4px solid var(--color-danger);
    box-shadow: var(--shadow-sm);
    animation: shake 0.5s ease-in-out;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ============================================================================
   FILES LIST
   ============================================================================ */

.files-list {
    background: var(--color-bg-card);
    border-radius: var(--radius-2xl);
    padding: 40px;
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.6s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.files-list h2 {
    color: var(--color-text-primary);
    margin-bottom: 24px;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ============================================================================
   FILE CARD
   ============================================================================ */

.file-card {
    background: linear-gradient(135deg, #fafafa 0%, #f4f4f5 100%);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-base);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-border);
}

.file-card:hover::before {
    transform: scaleY(1);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name-large {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    gap: 24px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
}

.file-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: white;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* ============================================================================
   FILE ACTIONS
   ============================================================================ */

.file-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.btn-download,
.btn-copy {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

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

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(99, 102, 241, 0.5);
}

.btn-copy {
    background: white;
    color: var(--color-text-primary);
    border: 2px solid var(--color-border);
}

.btn-copy:hover {
    background: var(--color-text-primary);
    color: white;
    border-color: var(--color-text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-download:active,
.btn-copy:active {
    transform: translateY(0);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    body {
        padding: 20px 16px;
    }
    
    header {
        margin-bottom: 32px;
    }
    
    .upload-section,
    .files-list {
        padding: 28px 24px;
        border-radius: var(--radius-xl);
    }
    
    .file-card {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px;
    }
    
    .file-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-download,
    .btn-copy {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    .file-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .selected-file {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .file-name {
        width: 100%;
        margin-right: 0;
    }
    
    .file-size {
        margin-right: auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 0.9375rem;
    }
    
    .upload-section,
    .files-list {
        padding: 20px;
    }
    
    .file-label {
        padding: 14px 24px;
        font-size: 0.9375rem;
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================================
   DARK MODE (OPCIONAL)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    }
    
    .upload-section,
    .files-list {
        background: var(--color-bg-secondary);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    h2 {
        color: #f1f5f9;
    }
    
    .file-card {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-color: rgba(255, 255, 255, 0.05);
    }
    
    .file-name-large,
    .file-name {
        color: #f1f5f9;
    }
    
    .file-meta span {
        background: rgba(255, 255, 255, 0.05);
        color: #cbd5e1;
    }
    
    .selected-file {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .file-size {
        background: rgba(255, 255, 255, 0.05);
        color: #cbd5e1;
    }
    
    .btn-copy {
        background: rgba(255, 255, 255, 0.05);
        color: #f1f5f9;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .btn-copy:hover {
        background: white;
        color: var(--color-text-primary);
    }
}

/* ============================================================================
   SCROLL PERSONALIZADO
   ============================================================================ */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-primary-dark), var(--color-secondary));
}

/* ============================================================================
   ANIMAÇÕES DE LOADING
   ============================================================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.btn-upload:disabled {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================================================
   UTILITÁRIOS
   ============================================================================ */

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


.upload-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #ccc;
    border-top: 3px solid #007bff; /* cor do spinner */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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