:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #3b82f6;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary);
}

nav {
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover, nav a.active {
    color: var(--primary);
}

/* Hero */
.hero {
    padding: 4rem 0 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero .accent {
    color: var(--primary);
}

.hero p {
    color: var(--text-muted);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
}

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

.drop-zone {
    position: relative;
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background: #f1f5f9;
}

.drop-zone-content svg {
    color: var(--primary);
    margin-bottom: 1rem;
}

.drop-zone-content p {
    color: var(--text-muted);
    font-size: 1rem;
}

.drop-zone-content .browse {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

/* Upload List */
.upload-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon {
    background: #eff6ff;
    color: var(--primary);
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    display: block;
}

.file-progress-container {
    display: none; /* Hidden by default during verification */
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    width: 100%;
}

.file-progress-container.visible {
    display: flex;
}

.file-progress {
    flex: 1;
    height: 8px; /* Slightly thicker for better alignment */
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-percent {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 2.8rem;
    text-align: right;
    line-height: 1; /* Ensures text doesn't push height */
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Files Grid */
.files-section {
    padding-bottom: 4rem;
}

.files-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.file-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.file-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.file-card-name {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-all;
}

.file-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.copy-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.retry-btn {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.retry-btn:hover {
    background: #fecaca;
}

.file-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: block;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Preloader */
.preloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    animation: spin 1s linear infinite;
}

.loader-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Inline Turnstile */
.turnstile-inline {
    margin: 0.75rem 0;
    min-height: 65px;
    display: flex;
    justify-content: flex-start;
}

/* Adjust progress bar spacing when turnstile is present */
.upload-item .file-progress {
    margin-top: 0.75rem;
}

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

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    .hero {
        padding: 3rem 0 1.5rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .drop-zone {
        padding: 3rem 1rem;
    }

    .upload-item {
        padding: 0.75rem;
        gap: 0.75rem;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .file-icon {
        padding: 0.5rem;
    }

    .file-info {
        flex: 1;
        min-width: 0; /* Important for flexbox overflow */
    }

    .file-name {
        word-break: break-all;
    }

    .turnstile-inline {
        max-width: 100%;
        overflow: hidden;
    }

    .action-area {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}
