/* =========================================================
   KONNEXA 360 — Shared UI components
   (glass panels, buttons, forms, switches, tiles, modals)
   ========================================================= */

/* ---------- icons ---------- */
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.f { fill: currentColor; stroke: none; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- glass ---------- */
.glass {
    background: linear-gradient(180deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .025));
    border: 1px solid var(--line);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-head h2, .panel-head h3 { font-size: 16px; }
.panel-head p { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.panel-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- page grid helpers ---------- */
.page { display: flex; flex-direction: column; gap: 18px; animation: fade-up .35s ease; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.accent { color: var(--orange-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: 14px;
    font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
    cursor: pointer; border: 1px solid var(--line-2); background: var(--glass-2); color: var(--text);
    transition: background .2s, filter .2s, border-color .2s;
}
.btn:hover { background: var(--glass-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
    background: linear-gradient(135deg, var(--orange), var(--orange-2)); border-color: transparent;
    color: var(--on-orange); font-weight: 600; box-shadow: 0 10px 30px -10px rgba(255, 122, 26, .7);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.white { background: #fff; border-color: #fff; color: #08130E; font-weight: 600; }
.btn.white:hover { background: #E9EFEC; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--glass); color: var(--text); }
.btn.danger { border-color: rgba(248, 113, 113, .35); color: var(--danger); background: rgba(248, 113, 113, .06); }
.btn.danger:hover { background: rgba(248, 113, 113, .12); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.block { width: 100%; }

.icon-btn {
    width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none;
    background: var(--glass); border: 1px solid var(--line); color: var(--muted); cursor: pointer; position: relative; transition: .2s; text-decoration: none;
}
.icon-btn:hover { color: var(--text); background: var(--glass-2); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- form fields ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields .full { grid-column: 1 / -1; }
.field label, .field .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; letter-spacing: .02em; }
.field .req { color: var(--orange); }
.field .hint { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.field .error { font-size: 11.5px; color: var(--danger); margin-top: 6px; }

.input {
    display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
    border-radius: 14px; background: var(--field); border: 1px solid var(--line); color: var(--faint); transition: .2s;
}
.input:focus-within { border-color: rgba(255, 122, 26, .55); background: rgba(0, 0, 0, .3); box-shadow: 0 0 0 4px var(--orange-ring); color: var(--orange-2); }
.input.invalid { border-color: rgba(248, 113, 113, .55); }
.input input, .input select, .input textarea {
    flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 14.5px;
}
.input input::placeholder, .input textarea::placeholder { color: var(--faint); }
.input select { appearance: none; cursor: pointer; }
.input select option { background: var(--forest-1); }
.input.area { height: auto; align-items: flex-start; padding: 12px 14px; }
.input textarea { resize: none; min-height: 76px; line-height: 1.5; }
.input .suffix { font-size: 11px; color: var(--faint); white-space: nowrap; }

/* ---------- switch ---------- */
.switch {
    width: 44px; height: 26px; border-radius: 20px; background: rgba(255, 255, 255, .12);
    position: relative; cursor: pointer; flex: none; transition: .2s; border: 0;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on { background: var(--orange); }
.switch.on::after { left: 21px; }

.toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; border-radius: var(--radius-md); background: rgba(0, 0, 0, .2); border: 1px solid var(--line); margin-bottom: 10px;
}
.toggle-row b { font-weight: 500; font-size: 14px; display: block; }
.toggle-row span { font-size: 12.5px; color: var(--faint); }

/* ---------- chips / badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 3px 10px; border-radius: 20px;
    background: var(--glass-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.live { color: var(--good); border-color: rgba(74, 222, 128, .3); background: rgba(74, 222, 128, .08); }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.badge.draft { color: var(--orange-2); border-color: rgba(255, 122, 26, .3); background: var(--orange-soft); }

.segmented { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--field); border: 1px solid var(--line); gap: 2px; }
.segmented button { border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.segmented button.on { background: var(--glass-3); color: var(--text); }

/* ---------- stat tile ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat { padding: 20px; }
.stat .top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.stat .ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--line); color: var(--text); }
.stat .value { font-size: 30px; font-weight: 600; margin-top: 14px; letter-spacing: -.02em; }
.stat .delta { font-size: 12.5px; color: var(--good); display: inline-flex; gap: 4px; align-items: center; margin-top: 4px; }
.stat .delta.flat { color: var(--faint); }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--line); flex: none; }
.list-row .txt { flex: 1; min-width: 0; }
.list-row .txt b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .txt span { font-size: 12.5px; color: var(--faint); }
.list-row time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--line); color: var(--orange-2); }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
    background: rgba(2, 7, 5, .7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: fade-up .25s ease;
}
.modal { width: min(380px, 100%); padding: 26px; text-align: center; }
.modal h3 { font-size: 18px; }
.modal p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .fields { grid-template-columns: 1fr; }
    .stats { gap: 12px; }
    .stat { padding: 16px; }
    .stat .value { font-size: 24px; }
    .panel { padding: 18px; }
}
