/* ============ Админ-панель LANALOGIC — тёмный дашборд ============ */
:root {
    --bg: #0a0a16;
    --bg-2: #101022;
    --panel: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.09);
    --panel-hover: rgba(255, 255, 255, 0.07);
    --ink: #f2f2fb;
    --ink-soft: rgba(242, 242, 251, 0.62);
    --ink-faint: rgba(242, 242, 251, 0.38);
    --violet: #8b5cf6;
    --cyan: #22d3ee;
    --pink: #f472b6;
    --green: #34d399;
    --red: #fb7185;
    --gradient: linear-gradient(100deg, var(--violet), var(--cyan));
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    --font-head: "Unbounded", sans-serif;
    --font-body: "Inter", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.admin-body {
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 90% -10%, rgba(139, 92, 246, 0.18), transparent),
        radial-gradient(900px 500px at 5% 10%, rgba(34, 211, 238, 0.12), transparent),
        var(--bg);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
input, textarea, button { font-family: inherit; font-size: 1rem; }

.brand-mark {
    background: var(--gradient);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.75rem 1.4rem; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
    border: 1.5px solid transparent; cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(139, 92, 246, 0.55); }
.btn-outline { color: var(--ink); border-color: var(--panel-border); background: var(--panel); }
.btn-outline:hover { background: var(--panel-hover); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none !important; }

/* ---------- Логин ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-glow {
    position: absolute; width: 700px; height: 700px; border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.28), transparent 65%);
    top: -200px; right: -200px; pointer-events: none;
}
.login-card {
    position: relative; width: min(400px, 92vw);
    background: var(--panel); border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px); border-radius: var(--radius);
    padding: 2.4rem; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 1.1rem;
}
.login-brand { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.06em; font-size: 1.1rem; }
.login-card h1 { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; margin-bottom: 0.2rem; }

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field span { font-size: 0.85rem; color: var(--ink-soft); font-weight: 500; }
.field input[type="text"], .field input[type="password"], .field textarea, .field input[type="file"] {
    background: rgba(255, 255, 255, 0.05); border: 1.5px solid var(--panel-border);
    border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; color: var(--ink);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus, .field textarea:focus {
    outline: none; border-color: var(--violet); background: rgba(255, 255, 255, 0.07);
}
.field textarea { resize: vertical; min-height: 3.2rem; font-family: var(--font-body); }
.field-checkbox { flex-direction: row; align-items: center; gap: 0.6rem; }
.field-checkbox input { width: 18px; height: 18px; accent-color: var(--violet); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; }
.alert-error { background: rgba(251, 113, 133, 0.14); color: #fecdd3; border: 1px solid rgba(251, 113, 133, 0.35); }

/* ---------- Layout ---------- */
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-sidebar {
    padding: 1.6rem 1.2rem; border-right: 1px solid var(--panel-border);
    display: flex; flex-direction: column; gap: 2rem; position: sticky; top: 0; height: 100vh;
}
.admin-brand { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.06em; font-size: 1.05rem; }
.admin-nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.admin-nav a {
    padding: 0.65rem 0.9rem; border-radius: var(--radius-sm); color: var(--ink-soft); font-weight: 500; font-size: 0.92rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a:hover { background: var(--panel); color: var(--ink); }
.admin-nav a.active { background: var(--panel); color: var(--ink); box-shadow: inset 2px 0 0 var(--violet); }

.admin-main { padding: 2rem 2.4rem 4rem; max-width: 1200px; }
.admin-main-narrow { max-width: 760px; }

/* ---------- Toast ---------- */
.toast {
    padding: 0.8rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.2rem; font-size: 0.92rem; font-weight: 500;
    animation: toast-in 0.25s ease;
}
.toast-success { background: rgba(52, 211, 153, 0.14); color: #a7f3d0; border: 1px solid rgba(52, 211, 153, 0.35); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Статы ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2.2rem; }
.stat-card {
    background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
    padding: 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 0.3rem;
}
.stat-value { font-family: var(--font-head); font-size: 1.8rem; font-weight: 600; }
.stat-label { font-size: 0.82rem; color: var(--ink-soft); }
.stat-card-reindex { gap: 0.5rem; }
.reindex-message { font-size: 0.75rem; color: var(--ink-faint); min-height: 1.1em; }

/* ---------- Секции ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 2.4rem 0 1.1rem; }
.section-head h2 { font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; }

/* ---------- Кейсы ---------- */
.admin-cases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.admin-case-card {
    background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.admin-case-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(139, 92, 246, 0.4); }
.admin-case-card.is-featured { border-color: rgba(139, 92, 246, 0.5); }
.admin-case-thumb { height: 110px; background-size: cover; background-position: center; }
.admin-case-body { padding: 1.1rem 1.2rem 0.6rem; flex: 1; }
.admin-case-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; gap: 0.5rem; }
.badge { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 999px; }
.badge-featured { background: rgba(139, 92, 246, 0.18); color: #d8bffc; }
.admin-case-metric { font-size: 0.78rem; color: var(--cyan); font-weight: 600; }
.admin-case-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.admin-case-card p { font-size: 0.85rem; color: var(--ink-soft); }
.admin-case-actions {
    display: flex; gap: 0.4rem; padding: 0.7rem 1rem; border-top: 1px solid var(--panel-border);
}
.icon-btn {
    width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05); border: 1px solid var(--panel-border); color: var(--ink-soft);
    cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--panel-hover); color: var(--ink); }
.icon-btn-danger:hover { background: rgba(251, 113, 133, 0.15); color: var(--red); }
.inline-form { display: inline; }
.empty-state { color: var(--ink-faint); font-size: 0.9rem; padding: 1rem 0; }

/* ---------- Форма кейса ---------- */
.case-form { display: flex; flex-direction: column; gap: 1.1rem; }
.image-preview { margin-top: 0.5rem; border-radius: var(--radius-sm); overflow: hidden; max-width: 240px; }
.image-preview img { width: 100%; display: block; }
.form-actions { display: flex; gap: 0.8rem; justify-content: flex-end; margin-top: 0.5rem; }

/* ---------- Заявки ---------- */
.leads-table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); }
.leads-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.leads-table th { text-align: left; padding: 0.8rem 1rem; color: var(--ink-faint); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--panel-border); }
.leads-table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--panel-border); vertical-align: top; }
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr.is-read { opacity: 0.5; }
.cell-wrap { max-width: 220px; white-space: pre-wrap; }
.lead-actions { display: flex; gap: 0.4rem; }

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; }
    .admin-nav { flex-direction: row; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .field-row { grid-template-columns: 1fr; }
    .admin-main { padding: 1.4rem; }
}
