/* ═══════════════════════════════════════════════════════════
   Web Sharing — CSS
   Dark theme · Glassmorphism · Micro-animations
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.5);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);

    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.3);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.3);
    --amber: #f59e0b;
    --cyan: #06b6d4;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-3%, -3%) rotate(3deg); }
}

/* ─── Layout ─── */
.app {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ─── Header ─── */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.35rem;
}

.header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ─── Action Bar ─── */
.action-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

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

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-danger {
    color: var(--red);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 20px var(--red-glow);
}

.btn .icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* ─── Dropzone ─── */
.dropzone {
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    transition: all var(--transition-slow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.dropzone.active,
.dropzone:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.dropzone.active::before,
.dropzone:hover::before {
    opacity: 1;
}

.dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.dropzone-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

.dropzone-text strong {
    color: var(--accent-hover);
}

.dropzone-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.35rem;
    position: relative;
    z-index: 1;
}

#fileInput {
    display: none;
}

/* ─── Paste Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform var(--transition-slow);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition);
    outline: none;
}

.modal-input:focus {
    border-color: var(--accent);
}

.modal-textarea {
    width: 100%;
    min-height: 220px;
    padding: 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 1.25rem;
    transition: border-color var(--transition);
    outline: none;
}

.modal-textarea:focus {
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ─── View Modal ─── */
.view-content {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 55vh;
    overflow-y: auto;
    color: var(--text-secondary);
}

.view-content::-webkit-scrollbar {
    width: 6px;
}

.view-content::-webkit-scrollbar-track {
    background: transparent;
}

.view-content::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 3px;
}

.view-image {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.view-header h2 {
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.view-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 1.5rem;
}

/* ─── File List ─── */
.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.file-list-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.file-count {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    transition: all var(--transition);
    animation: slideIn 0.3s ease-out both;
}

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

.file-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateX(4px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.file-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.file-icon.text { background: rgba(99, 102, 241, 0.15); }
.file-icon.image { background: rgba(16, 185, 129, 0.15); }
.file-icon.video { background: rgba(245, 158, 11, 0.15); }
.file-icon.audio { background: rgba(6, 182, 212, 0.15); }
.file-icon.binary { background: rgba(148, 163, 184, 0.15); }
.file-icon.paste { background: rgba(139, 92, 246, 0.15); }

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

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

.file-details {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.file-tag.paste-tag {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.file-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.file-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.file-btn:hover {
    background: var(--bg-glass);
    border-color: var(--border-glass);
    color: var(--text-primary);
    transform: scale(1.1);
}

.file-btn.delete:hover {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ─── Upload Progress ─── */
.upload-progress {
    margin-bottom: 1.5rem;
    display: none;
}

.upload-progress.show {
    display: block;
}

.progress-bar-container {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 8px;
    background: linear-gradient(90deg, var(--accent), var(--cyan));
    border-radius: 20px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastIn 0.3s ease-out;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

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

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

/* ─── Confirm Dialog ─── */
.confirm-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.confirm-filename {
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── Copy Button ─── */
.btn-copy {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .app {
        padding: 1.25rem 1rem 3rem;
    }

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

    .action-bar {
        gap: 0.5rem;
    }

    .btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.8rem;
    }

    .file-card {
        padding: 0.85rem 1rem;
    }

    .file-actions {
        gap: 0.25rem;
    }

    .file-btn {
        width: 30px;
        height: 30px;
    }

    .modal {
        padding: 1.5rem;
        width: 95%;
    }

    .dropzone {
        padding: 2rem 1.5rem;
    }
}
