// Home Network Inventory
// Custom styles and section color coding.
//
// Copyright (C) Mike Petrichenko
// e-mail: btframework@gmail.com
// Project repository: https://github.com/DroneTales/HomeNetworkInventory
//
// SPDX-License-Identifier: AGPL-3.0-or-later

/* ============================================================
   Custom styling for Home Network Inventory
   ============================================================ */

/* ---- Info cards with colored left border and icon ---- */

.info-card {
    border-left: 4px solid var(--section-color, #dee2e6);
}

.info-card .card-header {
    background-color: var(--section-bg, transparent);
    border-bottom: 1px solid var(--section-border, rgba(0, 0, 0, 0.125));
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.info-card .card-header i {
    color: var(--section-color, inherit);
    font-size: 1.05em;
}

.info-card .card-header .section-count {
    color: var(--bs-secondary-color);
    font-weight: 400;
    font-size: 0.9em;
    margin-left: 0.25rem;
}

/* ---- Section colors ---- */

.section-basic {
    --section-color: #6c757d;
    --section-bg: rgba(108, 117, 125, 0.08);
    --section-border: rgba(108, 117, 125, 0.2);
}

.section-interfaces {
    --section-color: #0d6efd;
    --section-bg: rgba(13, 110, 253, 0.08);
    --section-border: rgba(13, 110, 253, 0.2);
}

.section-ports {
    --section-color: #0dcaf0;
    --section-bg: rgba(13, 202, 240, 0.1);
    --section-border: rgba(13, 202, 240, 0.25);
}

.section-wifi {
    --section-color: #6f42c1;
    --section-bg: rgba(111, 66, 193, 0.08);
    --section-border: rgba(111, 66, 193, 0.2);
}

.section-dhcp {
    --section-color: #fd7e14;
    --section-bg: rgba(253, 126, 20, 0.08);
    --section-border: rgba(253, 126, 20, 0.2);
}

.section-credentials {
    --section-color: #dc3545;
    --section-bg: rgba(220, 53, 69, 0.08);
    --section-border: rgba(220, 53, 69, 0.2);
}

.section-services {
    --section-color: #198754;
    --section-bg: rgba(25, 135, 84, 0.08);
    --section-border: rgba(25, 135, 84, 0.2);
}

.section-remarks {
    --section-color: #ffc107;
    --section-bg: rgba(255, 193, 7, 0.12);
    --section-border: rgba(255, 193, 7, 0.3);
}

/* Dark theme tweaks: softer backgrounds */
[data-bs-theme="dark"] .section-basic,
[data-bs-theme="dark"] .section-interfaces,
[data-bs-theme="dark"] .section-ports,
[data-bs-theme="dark"] .section-wifi,
[data-bs-theme="dark"] .section-dhcp,
[data-bs-theme="dark"] .section-credentials,
[data-bs-theme="dark"] .section-services,
[data-bs-theme="dark"] .section-remarks {
    --section-bg: rgba(255, 255, 255, 0.04);
    --section-border: rgba(255, 255, 255, 0.1);
}

/* ---- Table headers with subtle icon spacing ---- */

.table thead th i {
    color: var(--bs-secondary-color);
    margin-right: 0.25rem;
    font-weight: 400;
}

/* ---- Mobile cards: same accent as info-card ---- */

.pf-row .form-label.small {
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-row .form-control-sm,
.pf-row .form-select-sm {
    font-size: 0.8rem;
}
.pf-row input[type="checkbox"].form-check-input {
    margin-top: 0;
}







@media (max-width: 767.98px) {
    
    
}


.credential-row .form-control-sm,
.credential-row .form-select-sm {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.interface-row .form-label.small {
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.interface-row .form-control-sm,
.interface-row .form-select-sm {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.credential-row .form-label.small {
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.credential-row .form-control-sm,
.credential-row .form-select-sm {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.dhcp-row .form-label.small {
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dhcp-row .form-control-sm,
.dhcp-row .form-select-sm {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.service-row .form-label.small {
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.service-row .form-control-sm,
.service-row .form-select-sm {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.port-row .form-label.small {
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.port-row .form-control-sm,
.port-row .form-select-sm {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.cytoscape-node-html-label {
    pointer-events: none !important;
}
#topology-container {
    overflow: hidden;
}

.topo-node {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: #334155;
    border: 2px solid #475569;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    color: #f1f5f9;
    cursor: pointer;
    user-select: none;
    pointer-events: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.topo-node i {
    font-size: 24px;
    color: #ffffff;
}
.topo-cat-modem        { background: linear-gradient(135deg, #6d28d9, #8b5cf6); border-color: #a78bfa; }
.topo-cat-hub          { background: linear-gradient(135deg, #475569, #64748b); border-color: #94a3b8; }
.topo-cat-wifi_router  { background: linear-gradient(135deg, #0e7490, #06b6d4); border-color: #22d3ee; }
.topo-cat-wifi_ap      { background: linear-gradient(135deg, #0891b2, #22d3ee); border-color: #67e8f9; }
.topo-cat-router       { background: linear-gradient(135deg, #1d4ed8, #3b82f6); border-color: #60a5fa; }
.topo-cat-camera       { background: linear-gradient(135deg, #b91c1c, #ef4444); border-color: #f87171; }
.topo-cat-video_server { background: linear-gradient(135deg, #7f1d1d, #dc2626); border-color: #fca5a5; }
.topo-cat-server       { background: linear-gradient(135deg, #047857, #10b981); border-color: #34d399; }
.topo-cat-other        { background: linear-gradient(135deg, #374151, #4b5563); border-color: #6b7280; }

.topo-tooltip {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    background: #0f172a;
    border: 1px solid #3b82f6;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
    max-width: 260px;
    min-width: 140px;
    opacity: 0;
    transition: opacity 0.12s ease;
    text-align: left;
}
.topo-tooltip.visible {
    opacity: 1;
}
.topo-tooltip-title {
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
    line-height: 1.25;
    margin-bottom: 2px;
}
.topo-tooltip-sub {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.3;
    margin-bottom: 6px;
    font-family: ui-monospace, SFMono-Regular, monospace;
}
.topo-tooltip-value {
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.4;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.topo-node {
    position: relative;
}
.topo-badge {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.topo-badge-wifi {
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0891b2;
    border: 2px solid #0b0f14;
    color: #ffffff;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.topo-badge-wifi-client {
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #0b0f14;
    color: #ffffff;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.topo-tooltip-wifi {
    font-size: 11px;
    color: #22d3ee;
    line-height: 1.5;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #1e293b;
    font-weight: 600;
}

.topo-wrap {
    overflow: hidden;
}
.topo-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 90%;
    height: 100%;
    background: #0f172a;
    border-left: 1px solid #334155;
    transform: translateX(105%);
    transition: transform 0.2s ease;
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 24px rgba(0, 0, 0, 0.35);
}
.topo-panel.open {
    transform: translateX(0);
}
.topo-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #1e293b;
    gap: 10px;
}
.topo-panel-title {
    font-weight: 700;
    font-size: 14px;
    color: #f8fafc;
    line-height: 1.2;
    word-break: break-word;
}
.topo-panel-title .topo-panel-sub {
    display: block;
    font-weight: 400;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, monospace;
}
.topo-panel-close {
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}
.topo-panel-close:hover {
    color: #f1f5f9;
    background: #1e293b;
}
.topo-panel-body {
    padding: 12px 14px;
    overflow-y: auto;
    flex: 1;
    color: #cbd5e1;
    font-size: 12px;
}
.topo-panel-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.topo-panel-actions a {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    background: #1d4ed8;
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}
.topo-panel-actions a:hover {
    background: #2563eb;
    color: #ffffff;
}
.topo-panel-section {
    margin-top: 14px;
}
.topo-panel-section-title {
    font-size: 10px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.topo-port-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.topo-port-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #1e293b;
    border-radius: 6px;
    font-size: 11px;
}
.topo-port-name {
    font-family: ui-monospace, SFMono-Regular, monospace;
    color: #e2e8f0;
    font-weight: 600;
    flex-shrink: 0;
}
.topo-port-arrow {
    color: #64748b;
    font-size: 10px;
}
.topo-port-target {
    color: #60a5fa;
    cursor: pointer;
    text-decoration: none;
    font-family: ui-monospace, SFMono-Regular, monospace;
    word-break: break-word;
}
.topo-port-target:hover {
    text-decoration: underline;
}
.topo-port-none {
    color: #64748b;
    font-style: italic;
}

.topo-legend {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    font-size: 12px;
    color: #cbd5e1;
    max-width: 240px;
    overflow: hidden;
}
.topo-legend-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 0;
    color: #e2e8f0;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
.topo-legend-toggle:hover {
    background: rgba(51, 65, 85, 0.5);
}
.topo-legend-toggle i {
    color: #60a5fa;
}
.topo-legend-body {
    display: none;
    padding: 4px 12px 10px 12px;
    border-top: 1px solid #334155;
}
.topo-legend.open .topo-legend-body {
    display: block;
}
.topo-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    line-height: 1.2;
}
.topo-legend-swatch {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f8fafc;
    font-size: 12px;
}
.topo-legend-badge {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0b0f14;
    font-size: 11px;
}
.topo-legend-badge-wifi {
    background: #22d3ee;
}
.topo-legend-badge-wifi-client {
    background: #3b82f6;
    color: #f8fafc;
}
.topo-legend-unassigned {
    background: rgba(124, 45, 18, 0.35);
    border: 2px dashed #ea580c;
}
.topo-legend-sep {
    height: 1px;
    background: #334155;
    margin: 6px 0;
}

.dev-badges-row {
    height: 18px;
    margin-top: 3px;
    display: flex;
    align-items: center;
}
.dev-badges {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
}
.dev-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1;
    background: #334155;
    color: #cbd5e1;
    border: 1px solid #475569;
}
.dev-badge i {
    font-size: 10px;
}
.dev-badge-count {
    font-size: 10px;
    font-weight: 600;
}
.dev-badge-pf-out {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #bfdbfe;
}
.dev-badge-pf-in {
    background: #14532d;
    border-color: #22c55e;
    color: #bbf7d0;
}
.dev-badge-dhcp {
    background: #4c1d95;
    border-color: #a78bfa;
    color: #ddd6fe;
}
.dev-badge-svc {
    background: #134e4a;
    border-color: #2dd4bf;
    color: #99f6e4;
}
.dev-badge-ports {
    background: #3f3f46;
    border-color: #71717a;
    color: #e4e4e7;
}

.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--bs-border-color);
    padding: 1rem 0;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.footer-brand:hover {
    color: var(--bs-body-color);
}

.footer-social {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 auto;
}

.footer-social .social {
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-social .social:hover {
    color: var(--bs-body-color);
}

.footer-copy {
    margin: 0;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
    .footer-social {
        margin: 0;
    }
}

.section-header {
    padding: 0.4rem 0.75rem;
    border-left: 4px solid var(--section-color, #dee2e6);
    background-color: var(--section-bg, transparent);
    border-radius: 0 0.25rem 0.25rem 0;
}

.section-header h2 {
    margin: 0;
}

.section-header i {
    color: var(--section-color, inherit);
}

/* Location drag-and-drop (Connections page) */
.location-group.drop-target {
    outline: 2px dashed var(--bs-primary);
    outline-offset: -4px;
}
.location-device.dragging {
    opacity: 0.5;
}
.location-device .drag-handle {
    cursor: grab;
}
.location-device .drag-handle:active {
    cursor: grabbing;
}

.dev-badges-inline {
    margin-left: 6px;
    vertical-align: middle;
}

/* IP type tags */
.ip-tag {
    display: inline-block;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 14px;
    vertical-align: middle;
    border: 1px solid;
}
.ip-tag-lstat { background: #3f3f46; border-color: #71717a; color: #e4e4e7; }
.ip-tag-ldhcp { background: #1e3a8a; border-color: #3b82f6; color: #bfdbfe; }
.ip-tag-lresv { background: #4c1d95; border-color: #a78bfa; color: #ddd6fe; }
.ip-tag-edhcp { background: #134e4a; border-color: #2dd4bf; color: #99f6e4; }
.ip-tag-estat { background: #14532d; border-color: #22c55e; color: #bbf7d0; }

/* IP line: address left, tag right */
.ip-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.ip-addr {
    font-variant-numeric: tabular-nums;
}

/* Interface row responsive layout */
@media (min-width: 768px) {
    .iface-col-name { max-width: 80px; }
    .iface-col-type { max-width: 95px; }
    .iface-col-mac { max-width: 150px; }
    .iface-col-band { max-width: 90px; }
    .iface-col-atype { max-width: 140px; }
}

.dev-badge-wifi-ap {
    background: #7c2d12;
    border-color: #fb923c;
    color: #fed7aa;
}

/* Interface drag & drop between network groups */
.iface-drag-handle {
    color: var(--bs-secondary-color);
    cursor: grab;
    padding: 0 2px;
    font-size: 0.9rem;
    line-height: 1;
}
.iface-drag-handle:active {
    cursor: grabbing;
}
.interface-row.dragging {
    opacity: 0.5;
}
.iface-group.drag-over > .iface-group-container {
    outline: 2px dashed var(--bs-primary);
    outline-offset: 2px;
    border-radius: 4px;
}
.iface-group.drag-over > .d-flex .fw-semibold,
.iface-group.drag-over > .d-flex a {
    color: var(--bs-primary);
}

.app-version {
    font-size: 0.7em;
    vertical-align: super;
    color: var(--bs-secondary-color);
    font-weight: 400;
}
