/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0f1117; --bg2: #1a1d27; --bg3: #242736; --border: #2e3148;
    --text: #e2e4f0; --text-muted: #7b82a8; --accent: #5b6cf9; --accent-hover: #4a5be0;
    --success: #22c55e; --error: #ef4444; --radius: 10px; --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 15px; line-height: 1.6; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
.navbar { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 60px; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link { padding: 6px 14px; border-radius: 6px; color: var(--text-muted); font-size: 14px; transition: all 0.15s; }
.nav-link:hover { color: var(--text); background: var(--bg3); }
.nav-link.active { color: var(--text); background: var(--bg3); }
.nav-user { color: var(--text-muted); font-size: 13px; padding: 0 8px; }
.nav-logout { color: var(--error); }
.nav-logout:hover { background: rgba(239,68,68,0.1); }
/* FIX: expanded max-width */
.main-content { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.page-header p { color: var(--text-muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg3); }
.btn-full { width: 100%; justify-content: center; }
.btn-copy { background: var(--bg3); color: var(--text); border: 1px solid var(--border); padding: 9px 16px; border-radius: 0 8px 8px 0; white-space: nowrap; }
.btn-copy:hover { background: var(--border); }
.btn-copy-sm { background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted); padding: 5px 8px; border-radius: 6px; cursor: pointer; transition: all 0.15s; flex-shrink: 0; display: inline-flex; align-items: center; }
.btn-copy-sm:hover { color: var(--text); background: var(--border); }
.btn-copy-sm.copied { color: var(--success); border-color: var(--success); }
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center; }
.auth-logo { width: 64px; height: 64px; background: rgba(91,108,249,0.15); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: var(--accent); }
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.auth-form { text-align: left; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-group input { width: 100%; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px; outline: none; transition: border-color 0.15s; }
.form-group input:focus { border-color: var(--accent); }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.upload-container { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.drop-zone { padding: 60px 40px; text-align: center; cursor: pointer; border: 2px dashed var(--border); margin: 24px; border-radius: 10px; transition: all 0.2s; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(91,108,249,0.06); }
.drop-zone svg { color: var(--text-muted); margin-bottom: 16px; }
.drop-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.drop-sub { color: var(--text-muted); font-size: 14px; }
.file-input { display: none; }
.upload-progress { padding: 28px 32px; }
.file-info { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.file-info-icon { width: 44px; height: 44px; background: var(--bg3); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.file-info-text { flex: 1; min-width: 0; }
.file-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 13px; color: var(--text-muted); }
.upload-status-badge { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: rgba(91,108,249,0.15); color: var(--accent); white-space: nowrap; }
.upload-status-badge.success { background: rgba(34,197,94,0.15); color: var(--success); }
.upload-status-badge.error { background: rgba(239,68,68,0.15); color: var(--error); }
.progress-bar-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.progress-bar { flex: 1; height: 8px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 99px; transition: width 0.3s ease; }
.progress-percent { font-size: 14px; font-weight: 600; min-width: 42px; text-align: right; }
.progress-details { font-size: 13px; color: var(--text-muted); }
.upload-result { padding: 32px; text-align: center; }
.result-success { display: inline-flex; align-items: center; gap: 10px; color: var(--success); font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.result-file-name { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.result-url-wrap { display: flex; max-width: 600px; margin: 0 auto 20px; }
.result-url-input { flex: 1; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border); border-right: none; border-radius: 8px 0 0 8px; color: var(--text); font-size: 13px; outline: none; }
.result-actions { display: flex; gap: 10px; justify-content: center; }
.upload-error { padding: 40px; text-align: center; }
.error-icon { width: 56px; height: 56px; background: rgba(239,68,68,0.1); color: var(--error); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; margin: 0 auto 16px; }
.upload-error p { color: var(--text-muted); margin-bottom: 20px; }
.files-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.search-form { display: flex; gap: 8px; flex: 1; }
.search-wrap { position: relative; flex: 1; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input { width: 100%; padding: 9px 36px 9px 38px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; outline: none; transition: border-color 0.15s; }
.search-input:focus { border-color: var(--accent); }
.search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; cursor: pointer; padding: 2px 4px; }
.search-clear:hover { color: var(--text); }
.search-results-info { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
/* FIX: horizontal scroll */
.files-table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* FIX: min-width so buttons dont get squeezed */
.files-table { width: 100%; min-width: 920px; border-collapse: collapse; }
.files-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.files-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.files-table tr:last-child td { border-bottom: none; }
.files-table tr:hover td { background: rgba(255,255,255,0.02); }
.td-display-name { width: 18%; min-width: 130px; font-weight: 600; }
.display-name-text { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-name { width: 18%; min-width: 130px; }
.td-size { color: var(--text-muted); white-space: nowrap; min-width: 75px; }
.td-date { color: var(--text-muted); white-space: nowrap; font-size: 13px; min-width: 125px; }
/* FIX: fixed width for url column */
.td-url { width: 320px; min-width: 260px; }
/* FIX: actions column always visible */
.td-actions { width: 56px; min-width: 56px; text-align: center; }
.file-row-name { max-width: 200px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.file-row-name.muted { color: var(--text-muted); font-size: 13px; }
.url-cell { display: flex; align-items: center; gap: 6px; }
.url-input { flex: 1; min-width: 0; padding: 6px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 12px; outline: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-input:focus { border-color: var(--accent); color: var(--text); }
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state svg { color: var(--border); margin-bottom: 20px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 24px; }
.setup-form { padding: 24px 24px 0; }
.label-hint { color: var(--text-muted); font-weight: 400; font-size: 12px; }
/* FIX: delete button always visible */
.btn-delete-sm { background: transparent; border: 1px solid transparent; color: var(--text-muted); padding: 5px 8px; border-radius: 6px; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-delete-sm:hover { color: var(--error); border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(2px); }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; max-width: 380px; width: 90%; text-align: center; box-shadow: var(--shadow); }
.modal-icon { width: 56px; height: 56px; background: rgba(239,68,68,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; color: var(--error); }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.hidden { display: none !important; }
