/* =========================================================
   U Horses v1.11 targeted horse editing and conversation UX
========================================================= */

/* My Horses: reliable content widths and label/value hierarchy. */
.uh-my-horses-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}
.uh-my-horse-card,
.uh-my-horse-body,
.uh-my-horse-heading,
.uh-horse-card-info-grid,
.uh-horse-meta-item {
    min-width: 0;
}
.uh-my-horse-body {
    gap: 16px;
    padding: 20px;
}
.uh-my-horse-heading {
    display: grid;
    gap: 6px;
}
.uh-my-horse-heading h2 {
    margin: 0;
    font-size: clamp(19px, 1.35vw, 22px);
    line-height: 1.28;
    word-break: normal;
    overflow-wrap: break-word;
}
.uh-my-horse-heading h2 a {
    color: var(--uh-text);
    text-decoration: none;
}
.uh-my-horse-price {
    display: block;
    color: var(--uh-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}
.uh-horse-card-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
}
.uh-horse-meta-item {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: baseline;
    gap: 7px;
}
.uh-horse-meta-item.is-wide {
    grid-column: 1 / -1;
}
.uh-horse-meta-label,
.uh-detail-label {
    color: var(--uh-text);
    font-weight: 600;
}
.uh-horse-meta-value,
.uh-detail-value {
    min-width: 0;
    color: var(--uh-muted);
    font-weight: 400;
    word-break: normal;
    overflow-wrap: anywhere;
}
.uh-horse-published {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 8px;
    margin: 0;
    padding-top: 13px;
    border-top: 1px solid var(--uh-border);
    font-size: 13px;
}
.uh-my-horse-actions {
    align-items: stretch;
    gap: 9px;
}
.uh-my-horse-actions > a {
    justify-content: center;
}

/* Horse details: readable facts without narrow value columns. */
.uh-alert + .uh-horse-detail-page {
    margin-top: 16px;
}
.uh-detail-facts {
    gap: 0 28px;
}
.uh-detail-item {
    grid-template-columns: minmax(130px, .42fr) minmax(0, 1fr);
    gap: 14px;
    padding: 13px 0;
}
.uh-detail-item.is-wide {
    grid-template-columns: minmax(155px, .22fr) minmax(0, 1fr);
}
.uh-detail-label {
    font-size: 13px;
    line-height: 1.5;
}
.uh-detail-value {
    font-size: 14px;
    line-height: 1.65;
}
.uh-detail-long-text,
.uh-detail-long-text p {
    font-size: 14px;
    line-height: 1.75;
}

/* Horse edit media: show current assets and preserve them clearly. */
.uh-existing-media,
.uh-existing-file {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--uh-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--uh-background) 74%, var(--uh-card));
}
.uh-existing-file a {
    color: var(--uh-primary);
    font-weight: 600;
    overflow-wrap: anywhere;
}
.uh-existing-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.uh-gallery-item {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--uh-border);
    border-radius: 12px;
    background: var(--uh-card);
}
.uh-gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 9px;
    object-fit: cover;
}
.uh-gallery-field {
    min-width: 0;
}
.uh-horse-form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* New Conversation: professional, spacious fields and independent result list. */
.uh-new-conversation-form {
    display: grid;
    gap: 20px;
}
.uh-modal-field {
    display: grid;
    gap: 8px;
    min-width: 0;
}
.uh-modal-field .uh-field-label {
    margin: 0;
}
.uh-search-input-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
}
.uh-search-input-wrap input[type="search"] {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    margin: 0;
    padding: 11px 48px 11px 46px;
    border: 1px solid var(--uh-border);
    border-radius: var(--uh-radius-input, 12px);
    background: var(--uh-input-bg, var(--uh-card));
    color: var(--uh-text);
    font: inherit;
    font-weight: 400;
    box-sizing: border-box;
    appearance: none;
}
.uh-search-input-wrap input[type="search"]::-webkit-search-cancel-button {
    display: none;
}
.uh-search-input-wrap input[type="search"]::placeholder,
.uh-initial-message-field textarea::placeholder {
    color: color-mix(in srgb, var(--uh-muted) 82%, transparent);
    opacity: 1;
}
.uh-search-input-wrap input[type="search"]:focus,
.uh-initial-message-field textarea:focus {
    border-color: var(--uh-primary);
    outline: 3px solid color-mix(in srgb, var(--uh-primary) 18%, transparent);
    outline-offset: 0;
}
.uh-search-input-icon {
    position: absolute;
    inset-inline-start: 15px;
    top: 50%;
    width: 20px;
    height: 20px;
    color: var(--uh-muted);
    transform: translateY(-50%);
    pointer-events: none;
}
.uh-search-input-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}
.uh-search-clear {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--uh-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}
.uh-search-clear:hover,
.uh-search-clear:focus-visible {
    background: color-mix(in srgb, var(--uh-primary) 9%, var(--uh-card));
    color: var(--uh-primary);
    outline: 0;
}
.uh-search-loading {
    position: absolute;
    inset-inline-end: 16px;
    top: 50%;
    width: 18px;
    height: 18px;
    border: 2px solid color-mix(in srgb, var(--uh-primary) 24%, transparent);
    border-top-color: var(--uh-primary);
    border-radius: 50%;
    transform: translateY(-50%);
    animation: uh-v111-spin .7s linear infinite;
}
@keyframes uh-v111-spin { to { transform: translateY(-50%) rotate(360deg); } }
.uh-conversation-search-field {
    margin-bottom: 0;
}
.uh-conversation-user-results {
    max-height: 300px;
    margin: -4px 0 0;
    padding: 4px;
    border: 1px solid var(--uh-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--uh-background) 44%, var(--uh-card));
    scrollbar-gutter: stable;
}
.uh-conversation-user-results:empty {
    display: none;
}
.uh-conversation-load-more {
    justify-self: start;
}
.uh-conversation-selected-user {
    margin: 0;
}
.uh-initial-message-field textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 130px;
    max-height: 260px;
    padding: 14px 16px;
    border: 1px solid var(--uh-border);
    border-radius: var(--uh-radius-input, 12px);
    background: var(--uh-input-bg, var(--uh-card));
    color: var(--uh-text);
    font: inherit;
    font-weight: 400;
    line-height: 1.55;
    resize: vertical;
    box-sizing: border-box;
}
.uh-field-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--uh-muted);
    font-weight: 400;
}
.uh-field-meta small {
    font-weight: 400;
}
.uh-new-conversation-form .uh-message-error:empty {
    display: none;
}
.uh-new-conversation-form .uh-modal-actions {
    margin-top: 0;
    padding-top: 4px;
}

@media (min-width: 1700px) {
    .uh-my-horses-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1240px) {
    .uh-my-horses-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .uh-my-horses-grid { grid-template-columns: 1fr; gap: 16px; }
    .uh-my-horse-body { padding: 17px; }
    .uh-horse-card-info-grid { grid-template-columns: 1fr; }
    .uh-horse-meta-item.is-wide { grid-column: auto; }
    .uh-my-horse-actions > a { flex: 1 1 calc(50% - 5px); min-width: 130px; }
    .uh-detail-item,
    .uh-detail-item.is-wide { grid-template-columns: 1fr; gap: 4px; }
    .uh-horse-form-actions { display: grid; grid-template-columns: 1fr; }
    .uh-horse-form-actions .uhc-btn { width: 100%; }
    .uh-conversation-dialog { padding: 16px; }
    .uh-new-conversation-form { gap: 16px; }
    .uh-conversation-user-results { max-height: 36vh; }
    .uh-field-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
    .uh-new-conversation-form .uh-modal-actions { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
    .uh-my-horse-actions > a { flex-basis: 100%; }
    .uh-search-input-wrap input[type="search"] { padding-inline-start: 42px; }
}
