/* ── FABRIC Service Marketplace ──
   The colour theme of the main FABRIC portal (portal.fabric-testbed.net;
   its styles/custom.scss and App.scss):

     primary / info  teal   #2196C9      dark     navy  #1B3A5C
     primary-light   sky    #5BC4E5      success        #008e7a
     secondary       gray   #5A6370      danger         #b00020
     warning         yellow #F5C518      text           #2D3540
     white page, #f8f9fa header and footer, Inter font, rounded cards

   The FABRIC portal compiles Bootstrap with these colours, and Bootstrap then
   picks the label colour that is readable on each: dark on teal, green, yellow
   and sky; white on navy, red and gray. This file is plain CSS on top of the
   stock Bootstrap build, so those label colours are set here by hand.
   Text links use FABRIC blue (#1A73B5): teal text on white is too faint (3.4:1).
*/

:root {
    --fabric-navy: #1B3A5C;
    --fabric-blue: #1A73B5;
    --fabric-teal: #2196C9;
    --fabric-teal-hover: #42A6D1;
    --fabric-sky: #5BC4E5;
    --fabric-yellow: #F5C518;
    --fabric-green: #008e7a;
    --fabric-green-hover: #269F8E;
    --fabric-red: #b00020;
    --fabric-gray: #5A6370;
    --fabric-text: #2D3540;
    --fabric-light: #EAF4FB;
    --fabric-gray-100: #F0F2F5;
    --fabric-border: #E2E6EA;
    --fabric-on-light: #000;   /* label colour on teal, green, yellow, sky */

    /* Bootstrap's own colours, so badges, alerts and utilities match */
    --bs-primary: #2196C9;
    --bs-primary-rgb: 33, 150, 201;
    --bs-secondary: #5A6370;
    --bs-secondary-rgb: 90, 99, 112;
    --bs-success: #008e7a;
    --bs-success-rgb: 0, 142, 122;
    --bs-danger: #b00020;
    --bs-danger-rgb: 176, 0, 32;
    --bs-warning: #F5C518;
    --bs-warning-rgb: 245, 197, 24;
    --bs-info: #2196C9;
    --bs-info-rgb: 33, 150, 201;
    --bs-dark: #1B3A5C;
    --bs-dark-rgb: 27, 58, 92;
    --bs-body-color: #2D3540;
    --bs-body-color-rgb: 45, 53, 64;
    --bs-body-bg: #fff;
    --bs-link-color: #1A73B5;
    --bs-link-color-rgb: 26, 115, 181;
    --bs-link-hover-color: #1B3A5C;
    --bs-link-hover-color-rgb: 27, 58, 92;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body {
    height: 100%;
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #fff;
    color: var(--fabric-text);
}
.main-content {
    flex: 1 0 auto;
}

/* ── Navbar: the FABRIC logo on a light bar, as on the FABRIC portal ── */
.fabric-navbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--fabric-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.fabric-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}
.fabric-subtitle {
    color: var(--fabric-gray);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-left: 0.75rem;
    border-left: 1px solid #c5cfda;
    line-height: 1.5;
}

.navbar-light .navbar-nav .nav-link {
    color: var(--fabric-gray);
    font-weight: 500;
}
/* As on the FABRIC portal: a yellow line under the link being pointed at */
.navbar-light .navbar-nav .nav-link {
    border-bottom: 3px solid transparent;
}
.navbar-light .navbar-nav .nav-link:hover {
    color: var(--fabric-gray);
    border-bottom-color: var(--fabric-yellow);
}
/* The page being shown */
.navbar-light .navbar-nav .nav-link.active {
    color: var(--fabric-navy);
    font-weight: 600;
    border-bottom-color: var(--fabric-yellow);
}
/* In the opened menu on a small screen the links are a list: no underlines */
@media (max-width: 991.98px) {
    .navbar-light .navbar-nav .nav-link,
    .navbar-light .navbar-nav .nav-link:hover,
    .navbar-light .navbar-nav .nav-link.active {
        border-bottom-color: transparent;
    }
}

/* ── Footer ── */
.fabric-footer {
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-top: 1px solid var(--fabric-border);
    color: var(--fabric-gray);
    padding: 1.5rem 0;
}
.fabric-footer a {
    color: var(--fabric-gray);
    text-decoration: none;
    line-height: 1.9;
}
.fabric-footer a:hover {
    color: var(--fabric-blue);
    text-decoration: underline;
}

/* ── Buttons: FABRIC colours, with the label colour Bootstrap picks for each ── */
.btn-primary {
    background-color: var(--fabric-teal);
    border-color: var(--fabric-teal);
    color: var(--fabric-on-light);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary:disabled {
    background-color: var(--fabric-teal-hover) !important;
    border-color: var(--fabric-teal-hover) !important;
    color: var(--fabric-on-light) !important;
}
.btn-outline-primary {
    color: var(--fabric-blue);
    border-color: var(--fabric-teal);
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--fabric-teal) !important;
    border-color: var(--fabric-teal) !important;
    color: var(--fabric-on-light) !important;
}
.btn-success {
    background-color: var(--fabric-green);
    border-color: var(--fabric-green);
    color: var(--fabric-on-light);
}
.btn-success:hover, .btn-success:focus, .btn-success:active {
    background-color: var(--fabric-green-hover) !important;
    border-color: var(--fabric-green-hover) !important;
    color: var(--fabric-on-light) !important;
}
.btn-dark {
    background-color: var(--fabric-navy);
    border-color: var(--fabric-navy);
}
.btn-dark:hover, .btn-dark:focus {
    background-color: #142c46;
    border-color: #142c46;
}
.btn-danger {
    background-color: var(--fabric-red);
    border-color: var(--fabric-red);
}
.btn-outline-danger {
    color: var(--fabric-red);
    border-color: var(--fabric-red);
}
.btn-outline-danger:hover {
    background-color: var(--fabric-red);
    border-color: var(--fabric-red);
}

/* ── Badges: same rule for the label colour ── */
.badge.bg-primary, .badge.bg-info, .badge.bg-success, .badge.bg-warning {
    color: var(--fabric-on-light) !important;
}

/* ── Forms ── */
.form-control:focus, .form-select:focus {
    border-color: var(--fabric-sky);
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 201, 0.2);
}
.form-check-input:checked {
    background-color: var(--fabric-teal);
    border-color: var(--fabric-teal);
}

/* ── Cards: rounded, with the FABRIC portal's soft navy shadow ── */
.card {
    border-radius: 1rem;
    border: 1px solid var(--fabric-border);
    box-shadow: 0 2px 12px rgba(27, 58, 92, 0.08), 0 1px 3px rgba(27, 58, 92, 0.06);
    overflow: hidden;
}
.card-header {
    background-color: var(--fabric-gray-100);
    border-bottom: 1px solid var(--fabric-border);
    color: var(--fabric-text);
    padding: 1rem 1.25rem;
}

/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
    font-family: "Inter", system-ui, sans-serif;
    color: var(--fabric-text);
}
h1, h2, h3 {
    font-weight: 400;
}

/* ── Landing page cards ── */
.landing-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid var(--fabric-border);
}
.landing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(27, 58, 92, 0.14), 0 2px 8px rgba(27, 58, 92, 0.08) !important;
}

/* ── Service gallery cards ── */
.service-card {
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--fabric-border);
}
.service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(27, 58, 92, 0.14), 0 2px 8px rgba(27, 58, 92, 0.08) !important;
}

/* ── Widget builder canvas ── */
#widget-canvas {
    min-height: 200px;
    background: #fafbfd;
    border-radius: 4px;
}

.widget-config-card {
    border-left: 4px solid var(--fabric-teal);
    background: #fff;
}

.widget-config-card .remove-widget-btn {
    opacity: 0.5;
}
.widget-config-card .remove-widget-btn:hover {
    opacity: 1;
}

/* ── Widget responses on service pages ── */
.widget-response {
    max-height: 300px;
    overflow: auto;
}
.widget-response pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ── Admin table tweaks ── */
.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}

/* ── Form field builder ── */
.input-field-row, .output-field-row {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 4px;
}

/* ── Links ── */
a {
    color: var(--fabric-blue);
}
a:hover {
    color: var(--fabric-navy);
}

/* ── Alerts: keep Bootstrap defaults but tweak info to match teal ── */
.alert-info {
    background-color: var(--fabric-light);
    border-color: #B8DDF2;
    color: var(--fabric-navy);
}

/* A service the user cannot use yet: only its picture is greyed, so its name and
   description stay easy to read; the "Request access" badge says what to do */
.service-card-locked .card-img-top {
    background-color: var(--fabric-gray-100) !important;
}
.service-card-locked .service-icon {
    filter: grayscale(1);
    opacity: 0.55;
}

/* The longer "About this service" text: plain text, the author's line breaks kept */
.service-details {
    white-space: pre-line;
    overflow-wrap: anywhere;
}
/* A card shows at most three lines of the description */
.service-card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* The user menu in the navbar */
.fabric-navbar .dropdown-item-text {
    white-space: normal;
    min-width: 14rem;
}
