/* S3 Backoffice — minimal Finder-like styling */

:root {
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --border: #e2e2e7;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --bg: #f5f5f7;
    --panel: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Header bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 52px;
    padding: 0 24px;
    background: #1d1d1f;
    color: #f5f5f7;
}

.topbar .brand {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}

.topbar .spacer {
    flex: 1;
}

.topbar .username {
    color: #a1a1a6;
    font-size: 13px;
}

.topbar .logout {
    color: #f5f5f7;
    font-size: 13px;
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid #48484d;
    border-radius: 6px;
}

.topbar .logout:hover {
    background: #2c2c2e;
    text-decoration: none;
}

/* ---------- Content ---------- */

.content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

/* ---------- Flash messages ---------- */

.flash-success,
.flash-error {
    padding: 10px 14px;
    margin: 0 0 16px;
    border-radius: 8px;
    font-size: 14px;
}

.flash-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--muted);
}

.breadcrumbs a {
    padding: 3px 6px;
    border-radius: 6px;
}

.breadcrumbs .crumb-sep {
    margin: 0 2px;
    color: var(--muted);
}

.breadcrumbs .crumb-current {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Toolbar ---------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    padding: 12px 16px;
    margin: 0 0 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.toolbar form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* ---------- Inputs & buttons ---------- */

input[type="text"],
input[type="password"],
input[type="file"] {
    font: inherit;
    font-size: 14px;
    padding: 6px 10px;
    background: #fff;
    color: var(--text);
    border: 1px solid #d2d2d7;
    border-radius: 6px;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

button {
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    padding: 6px 14px;
    background: #fff;
    color: var(--text);
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    cursor: pointer;
}

button:hover {
    background: #f0f0f2;
}

/* ---------- File table ---------- */

#file-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    font-size: 14px;
}

#file-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    padding: 10px 14px;
    background: #fafafa;
    border-bottom: 1px solid var(--border);
}

#file-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

#file-table tbody tr:last-child td {
    border-bottom: none;
}

#file-table tbody tr:not(.row-empty):hover {
    background: #f5f8ff;
}

.row-folder {
    font-weight: 500;
}

.row-file {
    cursor: grab;
}

.row-empty td {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

#file-table .actions {
    white-space: nowrap;
    text-align: right;
}

#file-table .actions a {
    margin-right: 10px;
}

#file-table .actions form {
    display: inline-block;
    margin: 0;
}

#file-table .actions button {
    padding: 3px 10px;
    font-size: 13px;
}

/* ---------- Drag & drop ---------- */

.drag-over {
    outline: 2px solid #2563eb;
    background: #eff6ff;
}

.dragging {
    opacity: .5;
}

/* ---------- Login ---------- */

.login-card {
    max-width: 360px;
    margin: 10vh auto 0;
    padding: 32px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
    margin: 0 0 20px;
    font-size: 20px;
    text-align: center;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-card label {
    font-size: 13px;
    color: var(--muted);
}

.login-card input {
    width: 100%;
}

.login-card button {
    margin-top: 8px;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.login-card button:hover {
    background: var(--accent-dark);
}

.login-error {
    padding: 8px 12px;
    margin: 0 0 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 13px;
}

/* ---------- Editor ---------- */

.editor-title {
    margin: 0 0 16px;
    font-size: 20px;
    word-break: break-all;
}

#editor-content {
    width: 100%;
    min-height: 60vh;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.5;
    background: var(--panel);
    color: var(--text);
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    resize: vertical;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.editor-actions button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.editor-actions button:hover {
    background: var(--accent-dark);
}
