/* ============================================
   butifal.css - UC.Files Design System
   ============================================ */

:root {
    --bg: #0e0e0e;
    --text: #e8e8e8;
    --link: #5ba8f5;
    --border: #2a2a2a;
    --light-bg: #161616;
    --danger: #ff6b6b;
    --success: #4caf50;
    --hover-bg: #1a1a1a;
    --accent: #5b9bd5;
    --accent-hover: #4a8ac4;
    --muted: #999999;
    color-scheme: dark;
}

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

body {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

.container { max-width: 800px; margin: 0 auto; }

/* -- Header -- */
header {
    border-bottom: 2px solid var(--text);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

h1 { margin: 0; font-size: 1.5rem; }
h2 { margin-top: 0; }
.subtitle { color: var(--muted); font-size: 0.9rem; }

/* -- Links -- */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; background: rgba(91, 155, 213, 0.1); }

/* -- Nav -- */
.nav-links { margin-bottom: 20px; font-size: 0.9rem; }

/* -- Buttons -- */
button {
    background-color: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    padding: 10px 20px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    font-weight: bold;
}
button:hover { background-color: var(--bg); color: var(--text); }
button:disabled { background-color: #555; border-color: #555; cursor: not-allowed; color: #999; }
button.small { padding: 4px 10px; font-size: 0.8rem; }
button.ghost { background: var(--bg); color: var(--text); }
button.ghost:hover { background: #2a2a2a; }
button.danger {
    background: var(--bg); color: var(--danger);
    border-color: var(--danger); font-size: 0.8rem; padding: 4px 10px;
}
button.danger:hover { background: #2a1010; }

/* -- Upload Area -- */
.upload-area {
    border: 2px dashed var(--text);
    background-color: var(--light-bg);
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 30px;
    transition: background-color 0.2s;
}
.upload-area.dragover { background-color: #222; border-style: solid; }

input[type="file"] { display: block; margin: 0 auto 20px auto; font-family: inherit; }

/* -- Progress Bar -- */
.progress-container {
    display: none;
    width: 100%;
    border: 1px solid var(--border);
    height: 28px;
    margin-top: 20px;
    background: #1a1a1a;
    position: relative;
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    width: 0%;
    transition: width 0.15s linear;
}
.progress-text {
    position: absolute; top: 0; left: 0; width: 100%;
    text-align: center; line-height: 28px;
    color: #ffffff; font-size: 0.85rem; font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* -- Breadcrumb -- */
.breadcrumb {
    background: var(--light-bg);
    border: 1px dashed var(--border);
    padding: 8px 15px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.breadcrumb a { margin: 0 2px; }
.breadcrumb .sep { color: var(--muted); margin: 0 2px; }

/* -- File Toolbar -- */
.file-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* -- Tables -- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    font-size: 0.9rem;
}
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background-color: var(--light-bg); font-weight: bold; border-bottom: 2px solid var(--text); }
tr:hover td { background-color: #1e1e1e; }
.text-right { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }

.empty {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    border: 1px dashed var(--border);
    margin-bottom: 24px;
}

/* -- Docs -- */
.docs-section {
    border-top: 2px solid var(--text);
    padding-top: 20px;
    margin-bottom: 30px;
    font-size: 0.9rem;
}
.docs-block {
    background: var(--light-bg);
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 15px;
    overflow-x: auto;
}
code {
    background: #2a2a2a;
    padding: 2px 4px;
    font-size: 0.85rem;
    word-break: break-all;
}

.docs-note {
    background: #2a2600;
    border: 1px solid #665c00;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

/* -- Modal -- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--bg); border: 2px solid var(--text);
    padding: 24px; min-width: 340px; max-width: 90vw;
}
.modal h2 { margin: 0 0 16px 0; font-size: 1rem; }
.modal input[type=text] {
    width: 100%; padding: 8px 10px; font-family: inherit;
    border: 1px solid var(--text); box-sizing: border-box; font-size: 0.9rem;
    background: var(--bg); color: var(--text);
}
.modal input[type=text]:focus {
    outline: none; border-color: var(--link);
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* -- Toast -- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--text); color: var(--bg);
    padding: 12px 20px; font-family: inherit; font-size: 0.85rem;
    z-index: 200; transform: translateY(60px); opacity: 0;
    transition: all 0.25s; max-width: 380px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* -- Footer -- */
footer {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
}

/* -- Utilities -- */
.hidden { display: none !important; }

/* -- Auth Panel -- */
.auth-panel {
    border: 2px solid var(--text);
    padding: 24px;
    margin-bottom: 30px;
    background: var(--light-bg);
}
.auth-panel h2 { margin: 0 0 12px 0; font-size: 1rem; }
.auth-panel p { margin: 0 0 16px 0; font-size: 0.85rem; color: var(--muted); }
.auth-tabs { display: flex; gap: 0; margin-bottom: 20px; }
.auth-tab {
    flex: 1; padding: 8px; text-align: center; cursor: pointer;
    border: 1px solid var(--text); background: var(--bg); color: var(--text); font-family: inherit;
    font-size: 0.85rem; font-weight: bold;
}
.auth-tab.active { background: var(--text); color: var(--bg); }
.auth-tab:hover:not(.active) { background: #2a2a2a; }
.hash-input {
    width: 100%; padding: 8px 10px; font-family: inherit;
    border: 1px solid var(--text); box-sizing: border-box; font-size: 0.9rem;
    margin-bottom: 12px; background: var(--bg); color: var(--text);
}
.hash-input:focus {
    outline: none; border-color: var(--link);
}

/* -- Account Header -- */
.account-bar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--light-bg); border: 1px solid var(--border);
    padding: 8px 15px; margin-bottom: 20px; font-size: 0.85rem;
}
.account-bar .hash-label { font-weight: bold; font-family: inherit; }
.account-bar .hash-blur { filter: blur(4px); cursor: pointer; transition: filter 0.2s; }
.account-bar .hash-blur:hover { filter: none; }
.account-bar button { font-size: 0.8rem; padding: 4px 12px; }

/* -- Hash Save Warning -- */
.hash-warning {
    background: #2a2600; border: 2px solid #8a6800;
    padding: 16px; margin-bottom: 20px; font-size: 0.85rem;
    color: #eeeeee;
}
.hash-warning strong { display: block; margin-bottom: 6px; }
.hash-display {
    font-family: inherit; font-size: 0.95rem; font-weight: bold;
    background: #1a1a1a; border: 1px solid var(--text); padding: 8px 12px;
    word-break: break-all; margin: 10px 0;
    color: var(--text);
}
.copy-btn {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--text); padding: 4px 12px;
    font-family: inherit; font-size: 0.8rem; cursor: pointer; font-weight: bold;
}
.copy-btn:hover { background: #2a2a2a; }

/* -- File Landing Page -- */
.file-landing {
    border: 2px solid var(--text);
    padding: 32px;
    margin-bottom: 30px;
    text-align: center;
}
.file-landing h2 { margin: 0 0 24px 0; font-size: 1.3rem; }
.file-meta-table {
    margin: 0 auto 28px auto;
    width: auto;
    min-width: 320px;
    text-align: left;
}
.file-meta-table td:first-child { color: var(--muted); padding-right: 24px; }
.download-btn {
    display: inline-block;
    background: var(--text); color: var(--bg);
    border: 2px solid var(--text);
    padding: 14px 36px; font-family: inherit; font-size: 1rem;
    font-weight: bold; text-decoration: none; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.download-btn:hover { background: var(--bg); color: var(--text); text-decoration: none; }

/* -- My Files -- */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 2px solid var(--text); padding-bottom: 8px; margin-bottom: 16px;
}
.section-header h2 { margin: 0; font-size: 1rem; }
.file-link-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -- Responsive -- */
@media (max-width: 600px) {
    body { padding: 12px; }
    .modal { min-width: auto; margin: 0 12px; }
    footer { flex-direction: column; gap: 4px; }
    .account-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* -- Upload result links -- */
.upload-links { text-align: left; }
.upload-link-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    word-break: break-all;
}
.upload-link-row:last-child { border-bottom: none; }
