/* Automatio Lite — style uzupełniające motyw Vuexy z portalu. */

:root {
    --accent: #2563eb;
    --lite-radius: 14px;
    --lite-muted: rgba(15, 23, 42, .6);
    --lite-card: #ffffff;
    --lite-stroke: rgba(15, 23, 42, .12);
    --lite-hero-bg: none;
}

html[data-theme="dark"] {
    --lite-muted: rgba(226, 232, 240, .65);
    --lite-card: #1f2937;
    --lite-stroke: rgba(255, 255, 255, .10);
}

.btn-primary, .badge-primary { background-color: var(--accent) !important; border-color: var(--accent) !important; }
.lite-muted { color: var(--lite-muted); }
.lite-gap { gap: .75rem; }

/* Przewijanie menu bocznego niezależnie od PerfectScrollbar (jak w portalu). */
.main-menu .main-menu-content { max-height: calc(100vh - 8rem); overflow-y: auto; overflow-x: hidden; }

.report-scroll {
    max-height: calc(100vh - 220px);
    overflow: auto;
}

.report-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
}

/* Własne logo (Administracja → Logo) w nagłówku menu: poziome, bez napisu „Automatio” obok. */
.main-menu .navbar-header .navbar-brand.lite-brand-custom { margin-top: .5rem; }
.main-menu .navbar-header .navbar-brand.lite-brand-custom .brand-logo { width: auto; height: auto; float: none; margin: 0; }
.main-menu .navbar-header .navbar-brand.lite-brand-custom .brand-logo .logo {
    display: block; left: 0; width: auto; height: auto;
    max-width: 170px; max-height: 40px; object-fit: contain;
}
body.vertical-layout.vertical-menu-modern.menu-collapsed .main-menu:not(.expanded) .navbar-brand.lite-brand-custom .brand-logo .logo { max-width: 44px; }

/* ---------- pasek górny / menu użytkownika ---------- */
.switch-tile { display: flex; flex-direction: column; align-items: center; min-width: 72px; }
.switch-label { margin-top: 6px; font-size: 11px; white-space: nowrap; color: var(--lite-muted); }
/* Motyw układa .user-nav w kolumnę (nazwa nad rolą) — w Lite avatar stoi obok nazwy. */
.header-navbar .navbar-container ul.nav li a.dropdown-user-link .user-nav { flex-direction: row; align-items: center; margin-right: 0; }
.header-navbar .navbar-container ul.nav li a.dropdown-user-link .user-nav .user-name { margin-bottom: 0; }
.lite-user-name { margin-right: .5rem; }
.lite-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 1.25rem;
}
.dropdown-menu form .dropdown-item { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; }

/* ---------- pulpit ---------- */
.lite-hero {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
    padding: 1.75rem; margin-bottom: 1.5rem; border-radius: var(--lite-radius); color: #fff;
    background-image: linear-gradient(135deg, rgba(15, 23, 42, .92), rgba(37, 99, 235, .78)), var(--lite-hero-bg);
    background-size: cover; background-position: center;
}
.lite-hero-compact { padding: 1.25rem 1.5rem; }
.lite-hero-kicker { margin: 0 0 .25rem; opacity: .8; }
.lite-hero-title { margin: 0; color: #fff; font-size: 1.75rem; font-weight: 600; }
.lite-hero-text { margin: .5rem 0 0; max-width: 60ch; opacity: .9; }
.lite-hero-text-multiline { white-space: pre-line; overflow-wrap: anywhere; }
.lite-search input { min-width: min(320px, 70vw); border-radius: 999px; }

.lite-section-title { margin: 1.5rem 0 .75rem; font-weight: 600; }

.lite-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.lite-tile {
    display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem;
    border-radius: var(--lite-radius); border: 1px solid var(--lite-stroke); background: var(--lite-card);
    color: inherit; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.lite-tile:hover, .lite-tile:focus-visible {
    transform: translateY(-2px); border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12); color: inherit; text-decoration: none;
}
.lite-tile-icon { font-size: 1.75rem; color: var(--accent); }
.lite-tile-name { font-weight: 600; }
.lite-tile-desc { font-size: .85rem; color: var(--lite-muted); }

.lite-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.lite-module {
    display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem;
    border-radius: var(--lite-radius); border: 1px dashed var(--lite-stroke);
}
.lite-module > i { font-size: 1.5rem; color: var(--accent); }

/* ---------- marketplace ---------- */
.lite-packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-top: 1rem; }
.lite-package {
    display: flex; flex-direction: column; gap: .6rem; padding: 1.1rem;
    border-radius: var(--lite-radius); border: 1px solid var(--lite-stroke); background: var(--lite-card);
}
.lite-package.is-active { border-color: #16a34a; box-shadow: 0 0 0 2px rgba(22, 163, 74, .25); }
.lite-package-head { display: flex; justify-content: space-between; gap: .5rem; }
.lite-package-desc { margin: 0; font-size: .9rem; }
.lite-package-modules { display: flex; flex-wrap: wrap; gap: .35rem; }
.lite-package-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; }
.lite-package-actions form { margin: 0; }
.lite-file { max-width: 360px; }

/* ---------- logowanie ---------- */
body.lite-auth {
    min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
}
.lite-auth-card {
    width: 100%; max-width: 400px; padding: 2rem; border-radius: var(--lite-radius);
    background: #fff; color: #0f172a; box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.lite-auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; font-size: 1.15rem; }
.lite-auth-title { font-size: 1.4rem; font-weight: 600; margin-bottom: 1rem; }
.lite-auth-hint { margin: 1rem 0 0; font-size: .85rem; color: rgba(15, 23, 42, .6); text-align: center; }

/* ---------- administracja ---------- */
.lite-tile-status {
    margin-top: auto; padding-top: .35rem; font-size: .8rem; font-weight: 600; color: var(--accent);
}
.lite-admin-tiles .lite-tile { min-height: 150px; }
.lite-scope-badge {
    font-size: .85rem; padding: .35rem .6rem; border-radius: 8px;
    background: rgba(37, 99, 235, .1); color: var(--accent);
}
.lite-activate { margin: 0; }
.lite-activate .lite-scope-select { max-width: 100%; min-width: 240px; flex: 1 1 240px; }
.lite-activate.is-compact { padding-top: .25rem; border-top: 1px dashed var(--lite-stroke); }

.lite-gateway { padding: .75rem 0; border-bottom: 1px solid var(--lite-stroke); }
.lite-gateway small { display: block; margin-left: 3.4rem; }
.lite-gateway-config { padding: .75rem 0 .25rem; margin-bottom: .75rem; border-bottom: 1px solid var(--lite-stroke); }

/* Przełączniki z tekstem w etykiecie: motyw daje etykiecie .custom-switch stałe 42×20 px (sam suwak),
   więc tekst zawijał się po kilka liter. Etykieta z treścią ma naturalną szerokość, suwak stoi po lewej.
   Pusta etykieta (np. przełącznik motywu w pasku górnym) zostaje bez zmian. */
.custom-switch .custom-control-label:not(:empty) {
    width: auto; height: auto; min-height: 20px; padding-left: 3.4rem; line-height: 20px; cursor: pointer;
}

/* ---------- logo strony logowania ---------- */
.lite-auth-brand.is-custom { justify-content: center; }
.lite-auth-logo { display: block; max-width: 100%; max-height: 96px; object-fit: contain; }
.lite-auth-preview { display: flex; justify-content: center; padding: 1.5rem; border-radius: var(--lite-radius); background: linear-gradient(135deg, #0f172a, #1e3a8a); }
.lite-auth-preview .lite-auth-card { box-shadow: none; }

/* ---------- konfiguracja instalacji i połączenia z bazami ---------- */
.lite-auth-card.is-wide { max-width: 860px; }
.lite-auth-note { color: rgba(15, 23, 42, .7); }
.lite-setup-steps { padding-left: 1.2rem; margin-bottom: 1rem; }
.lite-setup-steps li { margin-bottom: .25rem; }
.lite-connection { padding: 1rem 0; border-bottom: 1px solid var(--lite-stroke); }
.lite-connection:first-child { padding-top: 0; }
.lite-connection-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; }
.lite-connection-label { margin: 0; font-weight: 600; font-size: 1rem; text-transform: none; }
.lite-connection-value { word-break: break-all; }
.lite-mono { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: .85rem; }

/* ---------- wybór obszaru pracy (Home/Wybor) ---------- */
.lite-workspaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.lite-workspace-form { display: flex; margin: 0; }
.lite-workspace {
    --lite-workspace-overlay: rgba(255, 255, 255, .92);
    flex: 1; display: flex; flex-direction: column; gap: .6rem; padding: 1.25rem; text-align: left; color: inherit;
    border-radius: var(--lite-radius); border: 1px solid var(--lite-stroke); background-color: var(--lite-card);
    background-image: linear-gradient(var(--lite-workspace-overlay), var(--lite-workspace-overlay)), var(--lite-workspace-bg, none);
    background-size: cover; background-position: center; cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
html[data-theme="dark"] .lite-workspace { --lite-workspace-overlay: rgba(31, 41, 55, .92); }
.lite-workspace:hover, .lite-workspace:focus-visible {
    transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
}
.lite-workspace.is-current { border-color: #16a34a; box-shadow: 0 0 0 2px rgba(22, 163, 74, .25); }
.lite-workspace-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.lite-workspace-name { font-size: 1.1rem; font-weight: 600; }
.lite-workspace-desc { font-size: .88rem; color: var(--lite-muted); }
.lite-workspace-go { margin-top: auto; font-weight: 600; color: var(--accent); }

/* ---------- dostęp użytkowników ---------- */
.lite-users td { vertical-align: top; }
.lite-users code { white-space: nowrap; }
