/* ============================================
   FileTransfer — WeTransfer-inspired UI
   ============================================ */

:root {
    --primary: #406aff;
    --primary-dark: #3355e0;
    --primary-light: #eef2ff;
    --success: #22c55e;
    --danger: #ef4444;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    padding: 20px 32px;
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 20px;
}

.app-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-footer {
    padding: 20px 32px;
    text-align: center;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(64, 106, 255, 0.3);
}

.btn-primary:disabled {
    background: #c0ccf0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    cursor: pointer;
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Upload Card */
.upload-container {
    width: 100%;
    max-width: 560px;
}

.upload-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
}

.upload-header {
    text-align: center;
    margin-bottom: 32px;
}

.upload-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.upload-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

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

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-zone-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.drop-zone-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.file-input-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* File List */
.file-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
}

.file-list-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.file-list-items {
    max-height: 240px;
    overflow-y: auto;
}

.file-item,
.download-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.file-item:last-child,
.download-file-item:last-child {
    border-bottom: none;
}

.file-item:hover,
.download-file-item:hover {
    background: #f8fafc;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.file-size {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 8px;
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    margin-left: 12px;
}

.file-remove:hover {
    color: var(--danger);
}

.file-list-total {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #fafbfc;
    border-top: 1px solid var(--border);
}

/* Form */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group .optional {
    font-weight: 400;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 106, 255, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* Upload Progress */
.upload-progress {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(64, 106, 255, 0.15);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-status {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.progress-percent {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(64, 106, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-bar-fill.progress-error {
    background: var(--danger);
}

.progress-details {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Alert */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-error ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-error li + li {
    margin-top: 4px;
}

/* Status Pages */
.status-container {
    width: 100%;
    max-width: 520px;
}

.status-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px 40px;
    text-align: center;
}

.status-icon {
    margin-bottom: 24px;
}

.status-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.status-message {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 28px;
    line-height: 1.7;
}

.status-details {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.status-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Download Page */
.download-container {
    width: 100%;
    max-width: 560px;
}

.download-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
}

.download-header {
    text-align: center;
    margin-bottom: 28px;
}

.sender-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.download-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.download-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.download-message {
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.download-message p {
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
    line-height: 1.6;
}

.download-files {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.download-actions {
    margin-bottom: 16px;
}

.download-expiry {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
    .upload-card,
    .status-card,
    .download-card {
        padding: 28px 20px;
    }

    .upload-header h1 {
        font-size: 24px;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .app-header {
        padding: 16px 20px;
    }
}
