/*
 * Moventra portal theme in the style of the Fiori "Horizon" visual language.
 * Everything here is original CSS on top of Bootstrap (MIT); colour values follow the
 * Horizon palette, which is published under Apache-2.0. Font: Inter (SIL OFL 1.1), self-hosted.
 */

/* ---------- Inter (SIL Open Font License 1.1, self-hosted; see /fonts/OFL.txt) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Horizon theming parameters ---------- */
:root {
    --sapBrandColor: #0070f2;
    --sapHighlightColor: #0064d9;
    --sapBackgroundColor: #f5f6f7;
    --sapTextColor: #131e29;
    --sapTitleColor: #131e29;
    --sapContent_LabelColor: #556b82;
    --sapContent_FocusColor: #0032a5;
    --sapContent_ForegroundBorderColor: #758ca4;
    --sapContent_Shadow0: 0 0 0.125rem 0 rgba(34,53,72,.2), 0 0.125rem 0.25rem 0 rgba(34,53,72,.2);
    --sapContent_Shadow1: 0 0 0 0.0625rem rgba(34,53,72,.48), 0 0.125rem 0.5rem 0 rgba(34,53,72,.3);
    --sapContent_Shadow2: 0 0 0 0.0625rem rgba(34,53,72,.48), 0 0.625rem 1.875rem 0 rgba(34,53,72,.25);
    --sapShell_Background: #ffffff;
    --sapShell_Shadow: 0 0.125rem 0.125rem 0 rgba(34,53,72,.15), inset 0 -0.0625rem 0 0 rgba(34,53,72,.2);
    --sapShell_Hover_Background: #eaecee;
    --sapShell_Navigation_SelectedColor: #0064d9;
    --sapButton_BorderColor: #bcc3ca;
    --sapButton_TextColor: #0064d9;
    --sapButton_Hover_Background: #eaecee;
    --sapButton_Active_Background: #dee2e5;
    --sapButton_Emphasized_Background: #0070f2;
    --sapButton_Emphasized_Hover_Background: #0064d9;
    --sapButton_Selected_Background: #edf6ff;
    --sapButton_Accept_Background: #ebf5cb;
    --sapButton_Accept_TextColor: #256f3a;
    --sapButton_Reject_Background: #ffd6e9;
    --sapButton_Reject_TextColor: #aa0808;
    --sapButton_Attention_Background: #fff3b7;
    --sapButton_Attention_TextColor: #b44f00;
    --sapField_Background: #ffffff;
    --sapField_BorderColor: #556b81;
    --sapField_Hover_BorderColor: #0064d9;
    --sapField_ReadOnly_Background: #eaecee;
    --sapField_InvalidColor: #aa0808;
    --sapField_InvalidBackground: #ffeaf4;
    --sapList_BorderColor: #e5e5e5;
    --sapList_Hover_Background: #eaecee;
    --sapList_SelectionBackgroundColor: #ebf8ff;
    --sapList_TableHeaderTextColor: #556b82;
    --sapGroup_ContentBorderColor: #d9d9d9;
    --sapPositiveColor: #256f3a;      --sapPositiveElementColor: #30914c;  --sapPositive_Background: #f5fae5;
    --sapNegativeColor: #aa0808;      --sapNegativeElementColor: #f53232;  --sapNegative_Background: #fff4f2;
    --sapCriticalColor: #b44f00;      --sapCriticalElementColor: #e76500;  --sapCritical_Background: #fff8d6;
    --sapInformationColor: #0070f2;   --sapInformation_Background: #e1f4ff;
    --sapNeutralColor: #556b82;       --sapNeutralElementColor: #788fa6;   --sapNeutral_Background: #eff1f2;
    --sapFontFamily: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --sapFontSize: .875rem;
    --sapButton_BorderCornerRadius: .5rem;
    --sapField_BorderCornerRadius: .25rem;
    --sapElement_BorderCornerRadius: .75rem;

    /* Bootstrap → Horizon */
    --bs-body-font-family: var(--sapFontFamily);
    --bs-body-font-size: var(--sapFontSize);
    --bs-body-color: var(--sapTextColor);
    --bs-body-bg: var(--sapBackgroundColor);
    --bs-secondary-color: var(--sapContent_LabelColor);
    --bs-tertiary-bg: var(--sapShell_Background);
    --bs-border-color: var(--sapList_BorderColor);
    --bs-border-radius: var(--sapField_BorderCornerRadius);
    --bs-border-radius-sm: var(--sapField_BorderCornerRadius);
    --bs-border-radius-lg: var(--sapElement_BorderCornerRadius);
    --bs-primary: var(--sapBrandColor);
    --bs-primary-rgb: 0, 112, 242;
    --bs-primary-bg-subtle: var(--sapButton_Selected_Background);
    --bs-primary-text-emphasis: var(--sapHighlightColor);
    --bs-link-color: var(--sapHighlightColor);
    --bs-link-color-rgb: 0, 100, 217;
    --bs-link-hover-color: var(--sapHighlightColor);
    --bs-success-rgb: 37, 111, 58;
    --bs-danger-rgb: 170, 8, 8;
    --bs-warning-rgb: 231, 101, 0;
    --bs-info-rgb: 0, 112, 242;
    --bs-focus-ring-color: rgba(0, 50, 165, .25);
    --bs-heading-color: var(--sapTitleColor);
}

body { font-family: var(--sapFontFamily); font-size: var(--sapFontSize); background: var(--sapBackgroundColor); color: var(--sapTextColor);
    -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { font-family: var(--sapFontFamily); font-weight: 700; color: var(--sapTitleColor); }
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.text-secondary { color: var(--sapContent_LabelColor) !important; }
small, .small { font-size: .8125rem; }

/* Fiori focus: solid 2px focus colour, no glow */
:focus-visible, .btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
    outline: .125rem solid var(--sapContent_FocusColor) !important; outline-offset: .0625rem; box-shadow: none !important;
}

/* ---------- Shell bar ---------- */
.shellbar { height: 3.25rem; background: var(--sapShell_Background); box-shadow: var(--sapShell_Shadow); color: var(--sapTextColor);
    display: flex; align-items: center; gap: .75rem; padding: 0 1rem; position: sticky; top: 0; z-index: 1030; }
.shellbar-brand { display: flex; align-items: center; gap: .5rem; color: var(--sapTextColor); font-weight: 700; font-size: 1rem; }
.shellbar-brand:hover { text-decoration: none; color: var(--sapTextColor); }
.shellbar-mark { height: 1.75rem; width: auto; display: block; }
.brand-word { font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; }
.brand-move { color: #052250; } .brand-ntra { color: #0d9a90; }
.shellbar-logo { width: 2rem; height: 2rem; border-radius: .5rem; background: var(--sapBrandColor); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.shellbar-subtitle { color: var(--sapContent_LabelColor); font-weight: 400; font-size: .875rem; border-left: 1px solid var(--sapList_BorderColor); padding-left: .75rem; }
.shellbar-btn { border: 0; background: transparent; color: var(--sapTextColor); border-radius: var(--sapButton_BorderCornerRadius);
    height: 2.25rem; min-width: 2.25rem; padding: 0 .5rem; display: inline-flex; align-items: center; gap: .375rem; }
.shellbar-btn:hover { background: var(--sapShell_Hover_Background); }
.shellbar-avatar { width: 2rem; height: 2rem; border-radius: 50%; background: #5d36ff; color: #fff; font-weight: 700; font-size: .8125rem;
    display: inline-flex; align-items: center; justify-content: center; }
.shellbar .dropdown-menu { border: 0; border-radius: var(--sapElement_BorderCornerRadius); box-shadow: var(--sapContent_Shadow2); padding: .5rem; min-width: 15rem; }

/* ---------- Side navigation ---------- */
.sidebar { width: 16rem; background: #fff; border-right: 0 !important; box-shadow: 0.0625rem 0 0 0 var(--sapList_BorderColor); }
@media (min-width: 992px) { .sidebar { position: sticky; top: 3.25rem; height: calc(100vh - 3.25rem); overflow-y: auto; min-height: auto; } }
.sidebar .nav { padding: .5rem; gap: .125rem; }
.sidebar .nav-link { color: var(--sapTextColor); padding: 0 .75rem; height: 2.75rem; display: flex; align-items: center; gap: .5rem;
    border-radius: .5rem; font-size: .875rem; position: relative; }
.sidebar .nav-link:hover { background: var(--sapList_Hover_Background); text-decoration: none; }
.sidebar .nav-link.active { background: var(--sapButton_Selected_Background); color: var(--sapShell_Navigation_SelectedColor); font-weight: 700; }
.sidebar .nav-link.active::after { content: ""; position: absolute; left: .75rem; right: .75rem; bottom: 0; height: .1875rem;
    border-radius: .125rem .125rem 0 0; background: var(--sapShell_Navigation_SelectedColor); }
.sidebar .nav-link i { width: 1.25rem; font-size: 1rem; color: inherit; }
.sidebar-heading { font-size: .75rem; font-weight: 700; color: var(--sapContent_LabelColor); padding: 1rem .75rem .375rem; text-transform: none; letter-spacing: 0; }
.main-content { min-width: 0; }

/* ---------- Cards → Fiori cards / panels ---------- */
.card { --bs-card-border-width: 0; --bs-card-border-radius: var(--sapElement_BorderCornerRadius); --bs-card-inner-border-radius: var(--sapElement_BorderCornerRadius);
    box-shadow: var(--sapContent_Shadow0); background: #fff; }
.card-header { background: #fff; border-bottom: 1px solid var(--sapList_BorderColor); font-weight: 700; font-size: 1rem; padding: .75rem 1rem; color: var(--sapTitleColor); }
.card-footer { background: #fff; border-top: 1px solid var(--sapList_BorderColor); }
.city-filter { box-shadow: var(--sapContent_Shadow0); }

/* Numeric KPI tiles (Fiori numeric content) */
.stat-card { border-radius: 1rem !important; transition: box-shadow .15s; }
.stat-card:hover { box-shadow: var(--sapContent_Shadow1); }
.stat-card .card-body { padding: 1rem; }
.stat-card .label { order: -1; font-size: .875rem; font-weight: 700; color: var(--sapTitleColor); margin-bottom: .5rem; }
.stat-card .value { font-size: 2.25rem; font-weight: 400; line-height: 1; color: var(--sapNeutralColor); }
.stat-card .card-body { display: flex; flex-direction: column; }
.stat-card.kpi-positive .value { color: var(--sapPositiveElementColor); }
.stat-card.kpi-critical .value { color: var(--sapCriticalElementColor); }
.stat-card.kpi-negative .value { color: var(--sapNegativeElementColor); }
.stat-card.kpi-info .value { color: var(--sapBrandColor); }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-family: var(--sapFontFamily); --bs-btn-font-weight: 400; --bs-btn-border-radius: var(--sapButton_BorderCornerRadius);
    --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .4375rem; --bs-btn-font-size: .875rem; }
.btn-sm { --bs-btn-padding-x: .625rem; --bs-btn-padding-y: .25rem; --bs-btn-font-size: .875rem; --bs-btn-border-radius: var(--sapButton_BorderCornerRadius); }
.btn-primary { --bs-btn-bg: var(--sapButton_Emphasized_Background); --bs-btn-border-color: var(--sapButton_Emphasized_Background);
    --bs-btn-hover-bg: var(--sapButton_Emphasized_Hover_Background); --bs-btn-hover-border-color: var(--sapButton_Emphasized_Hover_Background);
    --bs-btn-active-bg: #0057d2; --bs-btn-active-border-color: #0057d2; --bs-btn-disabled-bg: var(--sapButton_Emphasized_Background);
    --bs-btn-disabled-border-color: var(--sapButton_Emphasized_Background); font-weight: 700; }
.btn-outline-primary, .btn-outline-secondary, .btn-outline-dark, .btn-outline-light {
    --bs-btn-color: var(--sapButton_TextColor); --bs-btn-bg: #fff; --bs-btn-border-color: var(--sapButton_BorderColor);
    --bs-btn-hover-color: var(--sapButton_TextColor); --bs-btn-hover-bg: var(--sapButton_Hover_Background); --bs-btn-hover-border-color: var(--sapButton_BorderColor);
    --bs-btn-active-color: var(--sapButton_TextColor); --bs-btn-active-bg: var(--sapButton_Active_Background); --bs-btn-active-border-color: var(--sapButton_BorderColor);
    --bs-btn-disabled-color: var(--sapButton_TextColor); --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: var(--sapButton_BorderColor); }
.btn-outline-success { --bs-btn-color: var(--sapButton_Accept_TextColor); --bs-btn-bg: var(--sapButton_Accept_Background); --bs-btn-border-color: var(--sapButton_Accept_Background);
    --bs-btn-hover-color: var(--sapButton_Accept_TextColor); --bs-btn-hover-bg: #dbeda0; --bs-btn-hover-border-color: #dbeda0; }
.btn-outline-warning { --bs-btn-color: var(--sapButton_Attention_TextColor); --bs-btn-bg: var(--sapButton_Attention_Background); --bs-btn-border-color: var(--sapButton_Attention_Background);
    --bs-btn-hover-color: var(--sapButton_Attention_TextColor); --bs-btn-hover-bg: #ffeb84; --bs-btn-hover-border-color: #ffeb84; }
.btn-outline-danger { --bs-btn-color: var(--sapButton_Reject_TextColor); --bs-btn-bg: var(--sapButton_Reject_Background); --bs-btn-border-color: var(--sapButton_Reject_Background);
    --bs-btn-hover-color: var(--sapButton_Reject_TextColor); --bs-btn-hover-bg: #ffc2de; --bs-btn-hover-border-color: #ffc2de; }
.btn-link { --bs-btn-color: var(--sapButton_TextColor); --bs-btn-hover-color: var(--sapButton_TextColor); text-decoration: none; }

/* ---------- Input fields ---------- */
.form-label { color: var(--sapContent_LabelColor); font-size: .875rem; margin-bottom: .25rem; }
.form-control, .form-select { font-family: var(--sapFontFamily); font-size: .875rem; color: var(--sapTextColor); background-color: var(--sapField_Background);
    border: 1px solid var(--sapField_BorderColor); border-radius: var(--sapField_BorderCornerRadius); min-height: 2.25rem;
    box-shadow: inset 0 -1px 0 var(--sapField_BorderColor); }
.form-control-sm, .form-select-sm { min-height: 2.25rem; font-size: .875rem; border-radius: var(--sapField_BorderCornerRadius); padding-top: .3125rem; padding-bottom: .3125rem; }
.form-control:hover, .form-select:hover { border-color: var(--sapField_Hover_BorderColor); box-shadow: inset 0 -1px 0 var(--sapField_Hover_BorderColor); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--sapField_InvalidColor); background-color: var(--sapField_InvalidBackground);
    box-shadow: inset 0 -1px 0 var(--sapField_InvalidColor); background-image: none; }
.invalid-feedback { color: var(--sapNegativeColor); }
.form-text { color: var(--sapContent_LabelColor); font-size: .75rem; }
.form-check-input { border-color: var(--sapField_BorderColor); border-radius: .125rem; }
.form-check-input:checked { background-color: var(--sapBrandColor); border-color: var(--sapBrandColor); }
.form-switch .form-check-input { border-radius: 2em; }

/* ---------- Tables → Fiori responsive table ---------- */
.table { --bs-table-color: var(--sapTextColor); --bs-table-bg: #fff; --bs-table-border-color: var(--sapList_BorderColor);
    --bs-table-hover-bg: var(--sapList_Hover_Background); --bs-table-hover-color: var(--sapTextColor); margin-bottom: 0; font-size: .875rem; }
.table > thead th { color: var(--sapList_TableHeaderTextColor); font-weight: 400; background: #fff; border-bottom: 1px solid var(--sapList_BorderColor);
    padding: .625rem .5rem; vertical-align: middle; }
.table > tbody td { padding: .5rem; height: 2.75rem; vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: .5rem; }
.table-primary { --bs-table-bg: var(--sapList_SelectionBackgroundColor); --bs-table-color: var(--sapTextColor); }

/* ---------- Object status (badges) ---------- */
.badge { font-family: var(--sapFontFamily); font-weight: 700; font-size: .75rem; border-radius: .25rem; padding: .1875rem .375rem; letter-spacing: 0; }
.status { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 700; border-radius: .25rem; padding: .125rem .375rem;
    border: 1px solid transparent; white-space: nowrap; line-height: 1.25rem; }
.status-positive { color: var(--sapPositiveColor); background: var(--sapPositive_Background); border-color: #c8e6a0; }
.status-negative { color: var(--sapNegativeColor); background: var(--sapNegative_Background); border-color: #ffc2c2; }
.status-critical { color: var(--sapCriticalColor); background: var(--sapCritical_Background); border-color: #ffe08a; }
.status-information { color: var(--sapHighlightColor); background: var(--sapInformation_Background); border-color: #b3dcff; }
.status-neutral { color: var(--sapNeutralColor); background: var(--sapNeutral_Background); border-color: #d5dadd; }
.text-bg-secondary, .text-bg-light { color: var(--sapNeutralColor) !important; background: var(--sapNeutral_Background) !important; }
.text-bg-success { color: var(--sapPositiveColor) !important; background: var(--sapPositive_Background) !important; }
.text-bg-danger { color: var(--sapNegativeColor) !important; background: var(--sapNegative_Background) !important; }
.text-bg-warning { color: var(--sapCriticalColor) !important; background: var(--sapCritical_Background) !important; }
.text-bg-info, .text-bg-primary { color: var(--sapHighlightColor) !important; background: var(--sapInformation_Background) !important; }

/* ---------- Message strips (alerts) ---------- */
.alert { border-radius: .5rem; border: 1px solid; font-size: .875rem; padding: .5rem .75rem; }
.alert-danger { color: var(--sapTextColor); background: var(--sapNegative_Background); border-color: #ff8888; }
.alert-success { color: var(--sapTextColor); background: var(--sapPositive_Background); border-color: #48a865; }
.alert-warning { color: var(--sapTextColor); background: var(--sapCritical_Background); border-color: #ff9a3d; }
.alert-info { color: var(--sapTextColor); background: var(--sapInformation_Background); border-color: #66a8ff; }

/* ---------- Dialogs, lists, toasts ---------- */
.modal-content { border: 0; border-radius: var(--sapElement_BorderCornerRadius); box-shadow: var(--sapContent_Shadow2); }
.modal-header { border-bottom: 1px solid var(--sapList_BorderColor); padding: .75rem 1rem; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-footer { border-top: 0; box-shadow: 0 -0.0625rem 0 var(--sapList_BorderColor); padding: .5rem 1rem; }
.list-group-item { border-color: var(--sapList_BorderColor); color: var(--sapTextColor); padding: .625rem 1rem; }
.list-group-item-action:hover { background: var(--sapList_Hover_Background); text-decoration: none; }
.toast { border-radius: .5rem; font-family: var(--sapFontFamily); background: rgba(34,53,72,.9) !important; color: #fff !important; box-shadow: var(--sapContent_Shadow2); }
.toast.text-bg-danger { background: var(--sapNegativeColor) !important; }
.offcanvas-lg { --bs-offcanvas-width: 16rem; }

/* ---------- Map ---------- */
#map { border-radius: var(--sapElement_BorderCornerRadius); box-shadow: var(--sapContent_Shadow0); }
.leaflet-container { font-family: var(--sapFontFamily); }
.leaflet-popup-content-wrapper { border-radius: .5rem; box-shadow: var(--sapContent_Shadow2); }
.marker-pin { width: 1.125rem; height: 1.125rem; border-radius: 50%; border: .1875rem solid #fff; box-shadow: 0 0 0 .0625rem rgba(34,53,72,.48), 0 .125rem .25rem rgba(34,53,72,.3); }
.marker-fresh { background: var(--sapPositiveElementColor); }
.marker-stale { background: var(--sapCriticalElementColor); }
.marker-outside { background: var(--sapNegativeElementColor); }
.marker-other { background: var(--sapNeutralElementColor); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; background: linear-gradient(160deg, #eff5ff 0%, #f5f6f7 55%); display: flex; align-items: center; }
.login-card { border-radius: 1rem; box-shadow: var(--sapContent_Shadow1); padding: 2rem; }
