/* FileStore — общие стили
   Палитра: белый / светло-серый / серый, текст — тёмно-серый (не чёрный)
   Без эмодзи — только svg-иконки */

:root {
    --bg-page: #f4f4f5;
    --bg-panel: #ffffff;
    --bg-panel-alt: #fafafa;
    --border: #e2e2e4;
    --border-strong: #d0d0d3;
    --text-primary: #2b2b2e;
    --text-secondary: #6b6b70;
    --text-muted: #9a9a9e;
    --accent: #3a3a3d;
    --accent-hover: #1f1f21;
    --danger: #b3413c;
    --danger-bg: #fbeceb;
    --success: #3d7a52;
    --success-bg: #eaf5ee;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
}

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

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

/* Auth layout (регистрация / вход) */

.auth-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.auth-visual {
    flex: 1.1;
    background-size: cover;
    background-position: center;
    position: relative;
    display: none;
}

.auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20,20,22,0.15) 0%, rgba(20,20,22,0.45) 100%);
}

.auth-visual__brand {
    position: relative;
    z-index: 1;
    padding: 48px;
    color: #f4f4f5;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

@media (min-width: 860px) {
    .auth-visual {
        display: block;
    }
}

.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--bg-panel);
}

.auth-form-wrap {
    width: 100%;
    max-width: 380px;
}

.auth-form-wrap h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.auth-form-wrap .subtitle {
    color: var(--text-secondary);
    margin: 0 0 28px;
    font-size: 14px;
}

/* Формы */

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 15px;
    background: var(--bg-panel);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(58, 58, 61, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

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

.auth-form-wrap .btn-primary {
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #ffffff;
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg-panel);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-panel-alt);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #f0d5d3;
}

.btn-danger:hover {
    background: #f6dbd9;
    text-decoration: none;
}

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

.btn-icon {
    padding: 8px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-panel-alt);
    border-color: var(--border);
    color: var(--text-primary);
}

.form-footer {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

/* Alerts / flash */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #f0d5d3;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #cfe9d7;
}

.alert-info {
    background: var(--bg-panel-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* App shell (после входа) */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 248px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.01), var(--shadow);
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    padding: 0 10px 28px;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.app-nav-link:hover {
    background: var(--bg-panel-alt);
    color: var(--text-primary);
    text-decoration: none;
    padding-left: 16px;
}

.app-nav-link.active {
    background: var(--bg-panel-alt);
    color: var(--text-primary);
    font-weight: 600;
}

.app-nav-link.active::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: var(--accent);
}

.app-nav-link .badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 7px;
}

.app-sidebar__storage {
    margin-top: auto;
    padding: 14px;
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
}

.storage-bar {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0;
}

.storage-bar__fill {
    height: 100%;
    background: var(--accent);
}

.app-main {
    flex: 1;
    padding: 32px 40px;
    max-width: 1100px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
    margin: -8px 0 20px;
}

.breadcrumb a {
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumb a:last-child {
    color: var(--text-primary);
    font-weight: 600;
    pointer-events: none;
    text-decoration: none;
}

.breadcrumb svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.select-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 15px;
    background: var(--bg-panel);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(58, 58, 61, 0.12);
}

/* File list */

.file-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.file-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel-alt);
}

.file-table td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

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

.file-table tbody tr {
    transition: background 0.12s ease;
}

.file-table tbody tr:hover {
    background: var(--bg-panel-alt);
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.file-icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.visibility-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--bg-panel-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.visibility-tag svg {
    width: 12px;
    height: 12px;
}

/* Upload dropzone */

.dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: 14px;
    padding: 36px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-panel-alt);
    margin-bottom: 24px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
    border-color: var(--accent);
    background: var(--bg-panel);
}

/* Modal */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 22, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-panel);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 26px;
}

.modal h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Settings */

.settings-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 28px;
    margin-bottom: 20px;
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
}

.settings-section .desc {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 18px;
}

.request-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

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

.request-row__info {
    font-size: 14px;
}

.request-row__info .file-name {
    font-weight: 600;
}

.request-row__info .requester {
    color: var(--text-secondary);
    font-size: 13px;
}

/* File view page */

.file-view-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px;
}

.file-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.file-view-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.file-view-content img,
.file-view-content video {
    max-width: 100%;
    border-radius: var(--radius-sm);
    display: block;
    margin: 0 auto;
}

.file-view-content pre,
.file-view-content textarea {
    width: 100%;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.file-view-content textarea {
    min-height: 400px;
    resize: vertical;
}

/* Utility */

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }

.icon {
    width: 1em;
    height: 1em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.15em;
}

@media print {
    .app-sidebar, .file-view-header, .no-print {
        display: none !important;
    }
    .app-main {
        padding: 0;
        max-width: 100%;
    }
}

@media (max-width: 720px) {
    .app-sidebar {
        display: none;
    }
    .app-main {
        padding: 20px;
    }
}
