/* ==========================================================================
   State Details Flyout
   ========================================================================== */

#state-details {
    --bs-offcanvas-width: min(520px, 100vw);

    background:
        linear-gradient(
            180deg,
            #ffffff 0,
            #f8f9fa 100%
        );
}

#state-details .offcanvas-header {
    padding: 1rem 1.5rem;

    background:
        linear-gradient(
            135deg,
            var(--color-1) 0,
            var(--color-2) 55%,
            var(--color-3) 100%
        );

    color: #fff;
    border-bottom: 0;
}

.state-details-header-content {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 1rem;
}

.state-details-flag {
    display: block;
    width: 112px;
    height: auto;
    flex: 0 0 auto;
    background: #000;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: .25rem;
    box-shadow: 0 .2rem .55rem rgba(0, 0, 0, .3);
    object-fit: contain;
}

.state-details-flag[hidden] {
    display: none;
}

.state-details-header-text {
    min-width: 0;
}

#state-details .offcanvas-title {
    margin: 0;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

#state-details .btn-close {
    align-self: flex-start;
    margin-left: auto;
    filter: invert(1) grayscale(1) brightness(2);
}

#state-details .offcanvas-body {
    padding: 1.35rem 1.5rem 1.5rem;
}


/* ==========================================================================
   Classification / Segment Cards
   ========================================================================== */

.state-details-classification {
    margin-bottom: 1.25rem;
}

.state-details-segments {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(150px, 1fr)
        );

    gap: .65rem;
}

.state-details-segment {
    position: relative;
    overflow: hidden;
    padding: .8rem .9rem .8rem 1rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .55rem;
    box-shadow: 0 .15rem .45rem rgba(0, 0, 0, .06);
}

.state-details-segment::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--segment-color, #6c757d);
}

.state-details-segment-label {
    margin-bottom: .15rem;
    color: #6c757d;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.state-details-segment-value {
    color: #212529;
    font-size: 1rem;
    font-weight: 750;
}

.state-details-segment-value::before {
    content: "";
    display: inline-block;
    width: .7rem;
    height: .7rem;
    margin-right: .4rem;
    background: var(--segment-color, #6c757d);
    border-radius: 50%;

    box-shadow:
        0 0 0 2px
        color-mix(
            in srgb,
            var(--segment-color, #6c757d) 18%,
            transparent
        );
}


/* ==========================================================================
   Single Classification
   ========================================================================== */

.state-details-single-classification {
    display: inline-flex;
    padding: .45rem .75rem;
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    color: #343a40;
    font-size: .85rem;
    font-weight: 700;
}


/* ==========================================================================
   Lead / Summary
   ========================================================================== */

.state-details-lead {
    grid-column: 1 / -1;
    position: relative;
    margin-bottom: 1rem;
    padding: 1rem 1.05rem;

    background:
        linear-gradient(
            135deg,
            rgba(91, 33, 182, .08),
            rgba(25, 217, 255, .06)
        );

    border: 1px solid rgba(91, 33, 182, .16);
    border-radius: .65rem;
}

.state-details-lead-label {
    margin-bottom: .35rem;
    color: #5b21b6;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.state-details-lead-value {
    color: #212529;
    font-size: .96rem;
    font-weight: 600;
    line-height: 1.5;
}


/* ==========================================================================
   Detail Fields
   ========================================================================== */

.state-details-content {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: .75rem;
}

.state-details-field {
    min-width: 0;
    padding: .85rem .9rem;
    background: rgba(255, 255, 255, .82);
    border: 1px solid #e2e6ea;
    border-radius: .55rem;
    box-shadow: 0 .1rem .3rem rgba(0, 0, 0, .035);
}

.state-details-label {
    margin-bottom: .3rem;
    color: #6c757d;
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .055em;
}

.state-details-value {
    color: #212529;
    font-size: .9rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}


/* ==========================================================================
   Child Records
   ========================================================================== */

.state-details-record {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .65rem;
    box-shadow: 0 .15rem .45rem rgba(0, 0, 0, .06);
}

.state-details-record-header {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .9rem;
}

.state-details-record-image {
    display: block;
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    object-fit: contain;
}

.state-details-record-name {
    min-width: 0;
    color: #212529;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
}

.state-details-record-description {
    margin-top: .85rem;
    color: #495057;
    font-size: .9rem;
    line-height: 1.5;
}

.state-details-record-field {
    margin-top: .65rem;
    padding-top: .65rem;
    color: #495057;
    border-top: 1px solid #e9ecef;
    font-size: .85rem;
    line-height: 1.45;
}

.state-details-record-field-label {
    color: #6c757d;
    font-weight: 700;
}

.state-details-record-field-value {
    overflow-wrap: anywhere;
}


/* ==========================================================================
   Long-Form Fields
   ========================================================================== */

/*
 * The JS creates these classes from the labels supplied by the INI.
 * These fields benefit from the full width of the flyout.
 */

.state-details-field-concealed-carry,
.state-details-field-open-carry,
.state-details-field-details,
.state-details-field-sources {
    grid-column: 1 / -1;
}

.state-details-field-details {
    background: #fff;
}

.state-details-field-details .state-details-value {
    line-height: 1.55;
}


/* ==========================================================================
   Sources
   ========================================================================== */

.state-details-field-sources {
    position: relative;
    padding-left: 1rem;
    background: #f1f3f5;
    border-color: #d9dee3;
}

.state-details-field-sources::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #1769e0;
    border-radius: .55rem 0 0 .55rem;
}

.state-details-field-sources .state-details-label {
    color: #1769e0;
}

.state-details-field-sources .state-details-value {
    color: #495057;
    font-size: .8rem;
}


/* ==========================================================================
   Metadata Footer
   ========================================================================== */

.state-details-meta {
    grid-column: 1 / -1;
    margin-top: .15rem;
    padding-top: .75rem;
    color: #6c757d;
    border-top: 1px solid #dee2e6;
    font-size: .75rem;
}

.state-details-meta-label {
    font-weight: 700;
}

.state-details-meta-value {
    font-weight: 500;
}


/* ==========================================================================
   Empty State
   ========================================================================== */

.state-details-empty {
    grid-column: 1 / -1;
    padding: 1rem;
    color: #6c757d;
    background: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: .55rem;
    font-size: .9rem;
    text-align: center;
}


/* ==========================================================================
   Responsive Flyout
   ========================================================================== */

@media (max-width: 575.98px) {

    #state-details .offcanvas-header {
        padding: .85rem 1.1rem;
    }

    .state-details-header-content {
        gap: .75rem;
    }

    .state-details-flag {
        width: 82px;
    }

    #state-details .offcanvas-title {
        font-size: 1.35rem;
    }

    #state-details .offcanvas-body {
        padding: 1rem 1.1rem;
    }

    .state-details-content {
        grid-template-columns: 1fr;
    }

    .state-details-field,
    .state-details-record {
        grid-column: 1;
    }

    .state-details-record-image {
        width: 60px;
        height: 60px;
        flex-basis: 60px;
    }

    .state-details-meta {
        grid-column: 1;
    }
}
