﻿/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */

/*-------------------------------------------*/
/* Fonts (matches UA Cloud Library)          */
/*-------------------------------------------*/
@import url(https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap);

/*-------------------------------------------*/
/* OPC UA brand palette & fonts              */
/*-------------------------------------------*/
:root {
    --opc-mid: #196096;
    --opc-dark: rgb(25, 96, 150);
    --opc-darker: #104a75;
    --opc-accent: #448FD1;
    --opc-light-1: #E8EFF4;
    --opc-light-2: #A3C4DE;
    --app-bar-main: var(--opc-dark);
    --app-bar-contrast: #ffffff;
    --app-bar-height: 64px;
    --page-bg: #f4f7fa;
    --card-bg: #ffffff;
    --card-border: #e3e9ef;
    --card-radius: .75rem;
    --card-shadow: 0 1px 2px rgba(8, 74, 121, .06), 0 .25rem 1rem rgba(8, 74, 121, .08);
    --card-shadow-hover: 0 1px 2px rgba(8, 74, 121, .08), 0 .75rem 2rem rgba(8, 74, 121, .18);
    --text-main: #1f2d3a;
    --text-muted: #5a6b7b;
    --success: #1e9e5a;
    --warning: #d48806;
    --font-body: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    --font-ui: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    --font-mono: 'Consolas', 'Cascadia Code', monospace;
}

/*-------------------------------------------*/
/* Base                                      */
/*-------------------------------------------*/
html {
    font-size: 14px;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* Flex-based sticky footer */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-main);
    background-color: var(--page-bg);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body > .container {
    flex: 1 0 auto;
}

h1 {
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.7rem;
    color: var(--opc-dark);
}

h2, h3, h4 {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.15rem;
}

p {
    line-height: 1.4rem;
    margin-bottom: .8rem;
}

a {
    font-family: var(--font-ui);
    color: #2d76a7;
}

    a:hover {
        color: var(--opc-darker);
    }

code {
    font-family: var(--font-mono);
}

.bg-primary {
    background-color: var(--opc-mid) !important;
}

/*-------------------------------------------*/
/* Buttons                                   */
/*-------------------------------------------*/
.btn-primary {
    color: #fff;
    background-color: var(--opc-mid);
    border-color: var(--opc-mid);
}

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-primary:not(:disabled):not(.disabled):active {
        color: #fff;
        background-color: var(--opc-darker);
        border-color: var(--opc-darker);
    }

    .btn-primary:focus {
        box-shadow: 0 0 0 .2rem rgba(25, 96, 150, .35);
    }

.btn-outline-primary {
    color: var(--opc-mid);
    border-color: var(--opc-mid);
    background-color: #fff;
}

    .btn-outline-primary:hover,
    .btn-outline-primary:focus,
    .btn-outline-primary:not(:disabled):not(.disabled):active {
        color: #fff;
        background-color: var(--opc-mid);
        border-color: var(--opc-mid);
    }

    .btn-outline-primary:focus {
        box-shadow: 0 0 0 .2rem rgba(25, 96, 150, .35);
    }

.form-control:focus {
    border-color: var(--opc-mid);
    box-shadow: 0 0 0 .2rem rgba(25, 96, 150, .2);
}

/*-------------------------------------------*/
/* App bar (mirrors the UA Cloud Library)    */
/*-------------------------------------------*/
header.app-bar {
    background-color: var(--app-bar-main);
    color: var(--app-bar-contrast);
    box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-bar-toolbar {
    min-height: 56px;
    padding: 0 .5rem;
}

@media (min-width: 768px) {
    .app-bar-toolbar {
        min-height: var(--app-bar-height);
        padding: 0 1.25rem;
    }
}

.app-bar-toolbar .container-fluid {
    gap: .75rem;
}

a.navbar-brand.app-bar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    flex-shrink: 0;
    padding: 0;
    margin-right: 0;
    color: var(--app-bar-contrast);
    white-space: nowrap;
    text-decoration: none;
}

    .app-bar-brand:hover,
    .app-bar-brand:focus {
        color: var(--app-bar-contrast);
        opacity: .85;
        text-decoration: none;
    }

.app-bar-logo {
    height: 46px;
    display: none;
}

@media (min-width: 576px) {
    .app-bar-logo {
        display: block;
    }
}

.app-bar-title {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 1.05rem;
    line-height: 1.6;
    letter-spacing: .0075em;
}

@media (min-width: 768px) {
    .app-bar-title {
        font-size: 1.2rem;
    }
}

.app-bar-nav-wrap {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.app-bar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .25rem;
    height: 46px;
    box-sizing: border-box;
    border-radius: 980px;
    background-color: rgba(255,255,255,.12);
}

.app-bar-nav-link {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: .375rem 1.125rem !important;
    border-radius: 980px;
    font-family: var(--font-ui);
    font-size: .95rem;
    font-weight: 500;
    line-height: 1;
    color: rgba(255,255,255,.85) !important;
    background-color: transparent;
    text-decoration: none;
    transition: background-color .15s ease-in-out, color .15s ease-in-out;
}

    .app-bar-nav-link:hover,
    .app-bar-nav-link:focus {
        background-color: rgba(255,255,255,.18);
        color: var(--app-bar-contrast) !important;
        text-decoration: none;
    }

    .app-bar-nav-link.active,
    .app-bar-nav-link.active:hover {
        background-color: var(--app-bar-contrast);
        color: var(--app-bar-main) !important;
    }

.app-bar-icon {
    width: 14px;
    height: 14px;
    margin-right: .5rem;
    fill: currentColor;
}

.app-bar-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.app-bar-action-link {
    font-size: .875rem;
    font-weight: 500;
    color: rgba(255,255,255,.85);
    padding: .375rem .75rem;
    border-radius: 980px;
    text-decoration: none;
}

    .app-bar-action-link:hover,
    .app-bar-action-link:focus {
        color: var(--app-bar-contrast);
        background-color: rgba(255,255,255,.18);
        text-decoration: none;
    }

@media (max-width: 767.98px) {
    .app-bar-toolbar .navbar-collapse {
        padding: .5rem 0 .75rem;
    }

    .app-bar-nav-wrap {
        justify-content: flex-start;
        margin-bottom: .5rem;
    }

    .app-bar-nav {
        height: auto;
    }

    .app-bar-nav-link {
        height: 38px;
    }
}

/*-------------------------------------------*/
/* Page header                               */
/*-------------------------------------------*/
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

    .page-header h1 {
        margin: 0 0 .35rem;
    }

.page-eyebrow {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--opc-accent);
    margin-bottom: .25rem;
}

.page-subtitle {
    color: var(--text-muted);
    max-width: 720px;
}

.page-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .75rem;
    border-radius: 980px;
    background-color: var(--opc-light-1);
    color: var(--opc-dark);
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
}

.meta-chip-value {
    font-weight: 700;
    color: var(--opc-darker);
    font-size: inherit;
}

code.meta-chip-value {
    font-weight: 600;
    background: transparent;
}

/*-------------------------------------------*/
/* Connection status badge                   */
/*-------------------------------------------*/
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .25rem .75rem;
    border-radius: 980px;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

.status-connecting {
    color: var(--warning);
    background-color: #fff7e6;
    border-color: #ffe0a3;
}

.status-live {
    color: var(--success);
    background-color: #e9f7ef;
    border-color: #b7e4c7;
}

    .status-live .status-dot {
        animation: status-pulse 1.6s ease-in-out infinite;
    }

.status-error {
    color: #c0392b;
    background-color: #fdecea;
    border-color: #f5c2bd;
}

@keyframes status-pulse {
    0% { box-shadow: 0 0 0 0 rgba(30, 158, 90, .55); }
    70% { box-shadow: 0 0 0 6px rgba(30, 158, 90, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 158, 90, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .status-live .status-dot {
        animation: none;
    }
}

/*-------------------------------------------*/
/* Toolbar & search                          */
/*-------------------------------------------*/
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.search-box {
    position: relative;
    flex: 0 1 360px;
}

    .search-box svg {
        position: absolute;
        left: .85rem;
        top: 50%;
        width: 14px;
        height: 14px;
        transform: translateY(-50%);
        fill: var(--text-muted);
        pointer-events: none;
    }

    .search-box .form-control {
        padding-left: 2.25rem;
        border-radius: 980px;
        border-color: var(--card-border);
        background-color: #fff;
    }

.toolbar-hint {
    color: var(--text-muted);
    font-size: .85rem;
}

/*-------------------------------------------*/
/* Partner tiles                             */
/*-------------------------------------------*/
.partner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.partner-tile {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    text-align: left;
    font-family: var(--font-ui);
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .15s ease-in-out, transform .15s ease-in-out, border-color .15s ease-in-out;
}

    .partner-tile:hover,
    .partner-tile:focus {
        border-color: var(--opc-light-2);
        box-shadow: var(--card-shadow-hover);
        transform: translateY(-2px);
        outline: none;
    }

    .partner-tile:focus-visible {
        box-shadow: 0 0 0 .2rem rgba(25, 96, 150, .35), var(--card-shadow-hover);
    }

.partner-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    padding: 1.25rem 1.5rem;
    background-color: #fff;
}

    .partner-logo img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        transition: opacity .15s ease-in-out;
    }

.partner-tile:hover .partner-logo img {
    opacity: .85;
}

.partner-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .65rem 1rem;
    border-top: 1px solid var(--card-border);
    background-color: #fafcfd;
}

.partner-name {
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.partner-action {
    flex-shrink: 0;
    font-size: .75rem;
    font-weight: 600;
    color: var(--opc-mid);
    opacity: .8;
    transition: opacity .15s ease-in-out;
}

.partner-tile:hover .partner-action {
    opacity: 1;
}

.partner-tile:hover .partner-footer {
    background-color: var(--opc-light-1);
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
    border: 2px dashed var(--card-border);
    border-radius: var(--card-radius);
    background-color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .partner-tile,
    .partner-tile:hover {
        transition: none;
        transform: none;
    }
}

/*-------------------------------------------*/
/* KPI cards                                 */
/*-------------------------------------------*/
.kpi-card {
    position: relative;
    height: 100%;
    padding: 1rem 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

    .kpi-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(180deg, var(--opc-accent) 0%, var(--opc-mid) 100%);
    }

.kpi-label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin: .25rem 0;
    color: var(--opc-dark);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value-sm {
    font-size: 1.15rem;
    line-height: 2.1rem;
}

.kpi-hint {
    font-size: .8rem;
    color: var(--text-muted);
}

/*-------------------------------------------*/
/* Dashboard cards                           */
/*-------------------------------------------*/
.dash-card {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

    .dash-card::before {
        content: "";
        display: block;
        height: 4px;
        background: linear-gradient(90deg, var(--opc-mid) 0%, var(--opc-accent) 100%);
    }

.dash-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    padding: 1rem 1.25rem .75rem;
    border-bottom: 1px solid var(--card-border);
}

.dash-card-title {
    margin: 0;
    color: var(--opc-dark);
}

.dash-card-subtitle {
    font-size: .8rem;
    color: var(--text-muted);
}

.dash-card-body {
    padding: 1.25rem;
}

.chart-container {
    position: relative;
    height: 380px;
    width: 100%;
}

@media (max-width: 575.98px) {
    .chart-container {
        height: 280px;
    }
}

/*-------------------------------------------*/
/* Telemetry table                           */
/*-------------------------------------------*/
.telemetry-table {
    font-size: .9rem;
}

    .telemetry-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: .75rem 1.25rem;
        font-size: .75rem;
        font-weight: 600;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--text-muted);
        background-color: #f7f9fb;
        border-top: 0;
        border-bottom: 1px solid var(--card-border);
    }

    .telemetry-table td {
        padding: .6rem 1.25rem;
        vertical-align: middle;
        border-top: 1px solid #eef2f6;
    }

    .telemetry-table tbody tr:hover {
        background-color: #f3f8fc;
    }

.telemetry-name {
    font-weight: 500;
    word-break: break-word;
}

.telemetry-value {
    font-family: var(--font-mono);
    color: var(--opc-darker);
    word-break: break-word;
}

.telemetry-time {
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table-placeholder {
    padding: 2rem 1.25rem !important;
    text-align: center;
    color: var(--text-muted);
}

/*-------------------------------------------*/
/* Footer (mirrors the UA Cloud Library)     */
/*-------------------------------------------*/
.footer {
    flex-shrink: 0;
    width: 100%;
    line-height: 1.8rem;
    padding: .5rem 1.25rem;
    background: linear-gradient(100deg, var(--opc-mid) 0%, var(--opc-dark) 100%);
    color: #fff;
}

    .footer a {
        color: inherit;
        opacity: .9;
        margin-right: 1.25rem;
        font-size: .9rem;
        white-space: nowrap;
    }

        .footer a:hover {
            color: inherit;
            opacity: .75;
        }

    .footer .footer-version a {
        margin-right: 0;
    }
