/* ============================================================
   UNLOAD PILLS
   Trailer, zone, and bay pill aesthetics.
   Paper background, warm tan borders, monospace IDs.
   Scoped to body:has(#sys-zoneload).
   ============================================================ */

/* === BASE PILL === */
body:has(#sys-zoneload) .pill {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0;
    padding: 10px 14px 8px;
    background: #fbf8f1;
    color: #1a1410;
    border: 1px solid #c9b896;
    border-radius: 2px;
    box-shadow: none;
    font-family: 'Atkinson Hyperlegible', 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-align: left;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
    overflow: hidden;
}

body:has(#sys-zoneload) .pill:hover {
    border-color: #ea580c;
    box-shadow: 0 2px 4px rgba(26, 20, 16, 0.06);
    transform: translateY(-1px);
    filter: none;
}

body:has(#sys-zoneload) .pill:active {
    transform: translateY(0);
}

/* Kill the old gradient overlay */
body:has(#sys-zoneload) .pill::before {
    display: none;
}

body:has(#sys-zoneload) .pill > * {
    position: relative;
    z-index: 1;
}

/* === ID META TEXT === */
body:has(#sys-zoneload) .pill-id {
    display: block;
    margin: 0;
    padding: 0;
    font-family: 'Atkinson Hyperlegible', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #1e3a5f;
    background: transparent;
    border-radius: 0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 1;
}

/* ============================================================
   OBJECT PILL (trailer)
   ============================================================ */

body:has(#sys-zoneload) .object-pill {
    background: #fbf8f1;
    color: #1a1410;
    width: 150px;
    min-height: 44px;
    overflow: hidden;
}

body:has(#sys-zoneload) .object-pill .object-pill-name,
body:has(#sys-zoneload) .object-pill .pill-id {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

body:has(#sys-zoneload) .object-pill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent 0,
        transparent 6px,
        rgba(194, 65, 12, 0.04) 6px,
        rgba(194, 65, 12, 0.04) 7px
    );
    pointer-events: none;
}

body:has(#sys-zoneload) .object-pill .object-pill-name {
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-weight: 700;
    font-size: 13px;
    color: #1a1410;
    letter-spacing: 0.02em;
    line-height: 1.15;
}

/* Selected trailer (JS sets inline background to green) */
body:has(#sys-zoneload) .object-pill[style*="1aaf5d"],
body:has(#sys-zoneload) .object-pill[style*="rgb(26, 175"] {
    background: #e8f5ec !important;
    border-color: #15803d !important;
    border-width: 2px !important;
    padding: 9px 13px 7px;
}

/* ============================================================
   RECEIVER PILL (zone)
   ============================================================ */

body:has(#sys-zoneload) .receiver-pill {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #fbf8f1;
    color: #1a1410;
    border: 1px solid #e3d8c2;
    border-top: 3px solid #1a1410;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    height: 240px;
    min-width: 0;
    overflow: hidden;
    text-align: left;
}

body:has(#sys-zoneload) .receiver-pill:hover {
    box-shadow: 0 4px 12px rgba(26, 20, 16, 0.08);
    border-top-color: #c2410c;
    transform: none;
}

body:has(#sys-zoneload) .receiver-pill .receiver-pill-name {
    display: block;
    padding: 12px 14px 4px;
    font-family: 'Familjen Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a1410;
}

body:has(#sys-zoneload) .receiver-pill .pill-id {
    padding: 0 14px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #9b8e7e;
    letter-spacing: 0.08em;
    font-weight: 400;
    text-transform: none;
}

/* Selected zone (JS sets inline background to orange) */
body:has(#sys-zoneload) .receiver-pill[style*="e07b00"],
body:has(#sys-zoneload) .receiver-pill[style*="rgb(224, 123"] {
    border-top-color: #c2410c !important;
    box-shadow: 0 0 0 2px #c2410c !important;
}
body:has(#sys-zoneload) .receiver-pill[style*="e07b00"] > .receiver-pill-name,
body:has(#sys-zoneload) .receiver-pill[style*="rgb(224, 123"] > .receiver-pill-name,
body:has(#sys-zoneload) .receiver-pill[style*="e07b00"] > .pill-id,
body:has(#sys-zoneload) .receiver-pill[style*="rgb(224, 123"] > .pill-id {
    color: #ffffff !important;
}

/* ============================================================
   BAY PILL
   ============================================================ */

body:has(#sys-zoneload) .bay-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #fbf8f1;
    color: #5a4f43;
    border: 1px solid #e3d8c2;
    border-radius: 2px;
    padding: 8px 4px;
    box-shadow: none;
    min-width: 0;
    min-height: 44px;
    height: 110px;
    text-align: center;
}

body:has(#sys-zoneload) .bay-pill:hover {
    background: #fef3e8;
    border-color: #c2410c;
}

body:has(#sys-zoneload) .bay-pill .bay-pill-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #5a4f43;
    letter-spacing: 0.04em;
    text-align: center;
    width: 100%;
    margin-bottom: 14px;
}

/* Hide the numeric AwareIM ID chip on bays */
body:has(#sys-zoneload) .bay-pill > .pill-id {
    display: none;
}

/* Occupied bay (data-occupied has value) */
body:has(#sys-zoneload) .bay-pill[data-occupied]:not([data-occupied=""]) {
    background: #fef3e8;
    border-color: #c2410c;
}
body:has(#sys-zoneload) .bay-pill[data-occupied]:not([data-occupied=""]) .bay-pill-name {
    color: #c2410c;
}

body:has(#sys-zoneload) .bay-pill .bay-pill-occupant {
    display: none;
    margin: 6px 0 0;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: #1a1410;
    background: transparent;
    border-radius: 0;
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-align: center;
}
body:has(#sys-zoneload) .bay-pill[data-occupied=""] .bay-pill-occupant {
    display: none;
}

/* Selected bay (JS sets inline background to orange) */
body:has(#sys-zoneload) .bay-pill[style*="e07b00"],
body:has(#sys-zoneload) .bay-pill[style*="rgb(224, 123"] {
    background: #e8f5ec !important;
    border: 2px solid #15803d !important;
    padding: 3px 1px;
}
