/* mcms stylesheet - light, sans-serif, responsive */

:root {
    --bg: #ffffff;
    --bg-alt: #f5f6f8;
    --border: #e2e4e9;
    --text: #1c1f26;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.45;
}

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

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 16px 20px 60px;
}

header.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

header.site-header .site-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    margin: 18px 0;
    color: var(--text-muted);
}

.breadcrumbs a { color: var(--text); font-weight: 500; }
.breadcrumbs .sep { color: var(--text-muted); }

.file-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.file-row {
    display: grid;
    grid-template-columns: 52px 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-alt); }

.file-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--accent);
    flex-shrink: 0;
}

.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb svg { width: 26px; height: 26px; }

.file-main { min-width: 0; }
.file-name {
    font-size: 17px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.file-desc {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 14px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.file-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
}
.icon-btn:hover { background: var(--bg-alt); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 17px;
}

/* File detail / view page */
.detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.detail-header .file-thumb { width: 60px; height: 60px; }
.detail-header .file-thumb svg { width: 32px; height: 32px; }
.detail-title { font-size: 22px; font-weight: 700; word-break: break-word; }

.detail-preview {
    text-align: center;
    margin: 20px 0;
}
.detail-preview img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    margin: 20px 0;
}
.meta-table tr { border-bottom: 1px solid var(--border); }
.meta-table td { padding: 10px 4px; vertical-align: top; }
.meta-table td:first-child {
    color: var(--text-muted);
    width: 140px;
    white-space: nowrap;
}
.meta-table .hash-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
}

.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-alt);
    border-radius: var(--radius);
}
.qr-box svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn.secondary {
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn.secondary:hover { background: #ebedf1; }
.btn svg { width: 18px; height: 18px; }

.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.copy-feedback {
    font-size: 14px;
    color: var(--accent);
    margin-left: 4px;
}

/* Error pages */
.error-page {
    text-align: center;
    padding: 100px 20px;
}
.error-page h1 { font-size: 64px; margin: 0; color: var(--text-muted); }
.error-page p { font-size: 18px; color: var(--text-muted); }

/* Wait overlay */
#mcms-wait-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.92);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 999;
    font-size: 18px;
    color: var(--text);
}
#mcms-wait-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: mcms-spin 0.8s linear infinite;
}
@keyframes mcms-spin { to { transform: rotate(360deg); } }

/* Login form (http auth uses browser dialog; this is a fallback style if needed) */
.login-box {
    max-width: 360px;
    margin: 80px auto;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Responsive */
@media (max-width: 640px) {
    body { font-size: 16px; }
    .container { padding: 12px 14px 50px; }
    .file-row {
        grid-template-columns: 44px 1fr auto;
        padding: 12px;
    }
    .file-meta { display: none; }
    .detail-header .file-thumb { width: 48px; height: 48px; }
    .detail-title { font-size: 19px; }
    header.site-header { padding: 12px 14px; }
}
