/* ============================================
   FullUpload — Premium Dark Theme Stylesheet
   ============================================ */

/* ─── CSS Custom Properties ──────────────────── */
:root {
    /* Core palette */
    --bg-primary:     #0a0a0f;
    --bg-secondary:   #12121a;
    --bg-card:        #16161f;
    --bg-elevated:    #1c1c28;

    /* Accent gradient */
    --accent-start:   #6c5ce7;
    --accent-mid:     #a855f7;
    --accent-end:     #ec4899;

    /* Text */
    --text-primary:   #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted:     #55556a;

    /* Borders */
    --border-subtle:  rgba(255, 255, 255, 0.06);
    --border-hover:   rgba(255, 255, 255, 0.12);
    --border-accent:  rgba(168, 85, 247, 0.4);

    /* Feedback */
    --success:        #10b981;
    --success-glow:   rgba(16, 185, 129, 0.2);
    --error:          #ef4444;
    --error-glow:     rgba(239, 68, 68, 0.15);
    --warning:        #f59e0b;

    /* Shadows */
    --shadow-sm:   0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(168, 85, 247, 0.15);

    /* Radii */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  20px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Reset & Base ───────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ─── Background Particles ───────────────────── */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: floatParticle 20s infinite ease-in-out;
}

@keyframes floatParticle {
    0%, 100% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    50% {
        transform: translateY(-10vh) scale(1);
    }
}

/* ─── App Container ──────────────────────────── */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 580px;
    padding: 24px;
    margin: 0 auto;
}

/* ─── Header ─────────────────────────────────── */
.app-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(168, 85, 247, 0.5); }
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-mid) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

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

/* ─── Drop Zone ──────────────────────────────── */
.drop-zone {
    position: relative;
    background: var(--bg-card);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s var(--ease-out);
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(168, 85, 247, 0.06),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.4s;
}

.drop-zone:hover::before,
.drop-zone:focus-visible::before {
    opacity: 1;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.drop-zone.drag-over {
    border-color: var(--accent-mid);
    background: rgba(168, 85, 247, 0.08);
    box-shadow: 0 0 60px rgba(168, 85, 247, 0.2);
    transform: scale(1.01);
}

.drop-zone.drag-over .upload-icon-ring {
    transform: scale(1.3);
    opacity: 0.6;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.upload-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.upload-icon-ring {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, 0.15);
    animation: ringPulse 3s ease-in-out infinite;
    transition: all 0.4s var(--ease-out);
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.15); opacity: 0.1; }
}

.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(236, 72, 153, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-mid);
}

.drop-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.drop-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.browse-link {
    color: var(--accent-mid);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.allowed-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ─── Upload Progress ────────────────────────── */
.upload-progress-container {
    animation: slideUp 0.5s var(--ease-spring);
}

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

.file-info-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.file-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(168, 85, 247, 0.1);
    border-radius: var(--radius-md);
}

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

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.cancel-btn {
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.progress-wrapper {
    margin-bottom: 12px;
}

.progress-bar-track {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-mid), var(--accent-end));
    border-radius: var(--radius-full);
    transition: width 0.3s var(--ease-out);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-bar-glow {
    position: absolute;
    top: -4px;
    left: 0;
    height: 16px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-mid));
    border-radius: var(--radius-full);
    filter: blur(8px);
    opacity: 0.5;
    transition: width 0.3s var(--ease-out);
    pointer-events: none;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#progressPercent {
    font-weight: 600;
    color: var(--accent-mid);
    font-variant-numeric: tabular-nums;
}

.chunk-info {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 8px 0;
}

/* ─── Result / Success ───────────────────────── */
.result-container {
    text-align: center;
    animation: slideUp 0.5s var(--ease-spring);
}

.success-animation {
    margin-bottom: 20px;
}

.success-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--success-glow);
    border: 2px solid var(--success);
    border-radius: 50%;
    color: var(--success);
    animation: successPop 0.6s var(--ease-spring);
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.result-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--success);
}

.result-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.link-card {
    margin-bottom: 20px;
}

.link-input-wrapper {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s;
}

.link-input-wrapper:focus-within {
    border-color: var(--border-accent);
}

.link-input {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    outline: none;
    min-width: 0;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-mid));
    border: none;
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.copy-btn:hover {
    filter: brightness(1.1);
}

.copy-btn.copied {
    background: var(--success);
}

.upload-another-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
}

.upload-another-btn:hover {
    border-color: var(--border-accent);
    color: var(--text-primary);
    background: rgba(168, 85, 247, 0.06);
}

/* ─── Error State ────────────────────────────── */
.error-container {
    text-align: center;
    padding: 32px;
    animation: slideUp 0.4s var(--ease-out);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.error-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--error);
    margin-bottom: 6px;
}

.error-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-full);
    color: var(--error);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
}

.retry-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

/* ─── Footer ─────────────────────────────────── */
.app-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.app-footer p {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ─── 404 Page ───────────────────────────────── */
.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-page-code {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 12px;
}

.error-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.error-page-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.error-page-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-mid));
    border-radius: var(--radius-full);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.error-page-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(168, 85, 247, 0.4);
}

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 600px) {
    .app-container {
        padding: 16px;
    }

    .drop-zone {
        padding: 36px 20px;
    }

    .allowed-types {
        gap: 6px;
    }

    .type-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .progress-stats {
        font-size: 0.75rem;
    }

    .link-input {
        font-size: 0.78rem;
        padding: 12px;
    }

    .copy-btn {
        padding: 12px 16px;
        font-size: 0.8rem;
    }

    .error-page-code {
        font-size: 4rem;
    }
}
