/**
 * Spectrum Broker - Global Styles
 * Based on Spectrum Admin admin.css, adapted for Broker.
 * These override/extend CoreUI defaults.
 */

/* ── Dark mode ── */
.c-dark-theme {
    /* Applied by broker.js based on prefers-color-scheme */
}

/* ── Menu header text should be visually distinct ── */
.dropdown-header {
    font-weight: bold;
    opacity: 0.7;
}

/* ── Eliminate awkward card header leading ── */
.card-header h2:only-child {
    margin-bottom: 0;
}

/* ── Right-align OK/Save buttons, left-align Cancel/Delete ── */
.card-footer {
    display: flex;
}

.modal-footer,
.card-footer {
    flex-direction: row-reverse;
    justify-content: space-between;
}

/* ── Prevent content jumping from inline validation messages ── */
.invalid-feedback,
.valid-feedback {
    display: block !important;
    visibility: hidden;
}

.is-invalid ~ .invalid-feedback {
    visibility: visible;
}

.is-valid ~ .valid-feedback {
    visibility: visible;
}

/* ── Form validation shims ── */
.form-control.input-validation-error {
    padding-right: calc(1.5em + .75rem);
    border-color: #e55353;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23e55353' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23e55353' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem);
    background-position: right calc(.375em + .1875rem) center;
}

/* ── Thumbnail sizing ── */
.img-thumbnail {
    min-width: 44px;
    max-width: 124px;
    object-fit: contain;
}

/* ── Button elevation (matches CoreUI Pro non-legacy theme) ── */
.c-app:not(.c-legacy-theme) .btn:not([class*=ghost]):not([class*=outline]):not([class*=transparent]) {
    border: 0;
    box-shadow: 0 1px 1px 0 rgba(var(--elevation-base-color), .14),
                0 2px 1px -1px rgba(var(--elevation-base-color), .12),
                0 1px 3px 0 rgba(var(--elevation-base-color), .20);
}

/* ── Disabled buttons ── */
.btn:disabled,
.btn.disabled {
    cursor: auto;
}

/* ── Dark mode link contrast ── */
.c-dark-theme a,
.c-dark-theme a:hover,
.c-dark-theme a:focus {
    color: #A3A9F1;
}
.c-dark-theme a.text-info,
.c-dark-theme a.text-info:hover,
.c-dark-theme a.text-info:focus {
    color: #86dafc !important;
}

/* ── Broker sidebar logo sizing ── */
.spectrum-logo {
    height: 52px;
    width: auto;
}

.spectrum-logo-sm {
    height: 35px;
    width: auto;
}

/* ── Client list table ── */
.client-list-table {
    max-width: 960px;
}

.client-list-table thead th {
    border-bottom: 2px solid rgba(255,255,255,.15);
}

.client-list-table tbody tr {
    cursor: pointer;
}

#clientSearch {
    min-width: 200px;
}

/* ── Environment-specific styles (Broker) ── */
.inactive-product {
    font-style: italic;
}

.environmental {
    padding: .75rem;
    border: 1px solid #d8dbe0;
    border-left: 5px solid #d8dbe0;
    border-radius: .25rem;
}

.c-dark-theme .environmental {
    border-color: #44454f;
}

/* ── Environment indicator badge ── */
.env-badge {
    display: inline-block;
    padding: .25em .65em;
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    border-radius: .2rem;
    background-color: #636f83;
    vertical-align: middle;
}

/* ── Toast container ── */
.toaster {
    position: fixed;
    z-index: 1090;
    pointer-events: none;
}

.toaster-bottom-right {
    right: 1rem;
    bottom: 1rem;
}

/* ── Environment page tabs ── */
.environmental .nav-tabs .nav-link {
    color: #4f5d73;
    font-weight: 500;
}

.environmental .nav-tabs .nav-link.active {
    font-weight: 600;
}

/* ── Cards inside environmental container ── */
.environmental .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.environmental .card-header {
    background-color: #f0f3f5;
    border-bottom: 2px solid #d8dbe0;
    padding: .5rem .75rem;
    font-size: .9rem;
}

.c-dark-theme .environmental .card-header {
    background-color: #33343e;
    border-bottom-color: #44454f;
}

/* ── Form inputs inside environmental: remove old max-width constraint ── */
.environmental input[type="text"],
.environmental input[type="email"],
.environmental input[type="password"],
.environmental select,
.environmental textarea {
    max-width: none;
}
