/* Animal Smart Matcher — Frontend v3.1 */
:root {
    --asm-high:    #16a34a;
    --asm-medium:  #d97706;
    --asm-low:     #6b7280;
    --asm-purple:  #6d28d9;
    --asm-radius:  18px;
    --asm-shadow:  0 4px 24px rgba(0,0,0,.07);
}

/* ── Contenedor ── */
.asm-container {
    margin: 2.5em 0;
    padding: 2em 2.2em;
    background: #fff;
    border-radius: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: var(--asm-shadow);
}

/* ── Cabecera ── */
.asm-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.asm-title  { font-size: 1.45em; font-weight: 800; color: #111827; margin: 0 0 6px; letter-spacing: -.02em; }
.asm-ai-summary { font-size: .88em; color: #6b7280; margin: 0; line-height: 1.5; }
.asm-ai-badge { background: #ede9fe; color: #6d28d9; font-size: .7em; font-weight: 700; padding: 2px 6px; border-radius: 6px; margin-right: 5px; vertical-align: middle; }
.asm-analyzed-badge { background: #ecfdf5; color: #065f46; font-size: .78em; font-weight: 700; padding: 5px 10px; border-radius: 8px; white-space: nowrap; align-self: center; }

/* ── Caso resuelto (animal reunido) ── */
.asm-resolved-banner {
    display: flex; align-items: center; gap: 16px;
    background: linear-gradient(135deg, #ede9fe, #fdf4ff);
    border: 1px solid #ddd6fe;
    border-radius: 16px;
    padding: 1.4em 1.6em;
    margin-bottom: 14px;
}
.asm-resolved-icon { font-size: 2.2em; line-height: 1; }
.asm-resolved-text strong { color: #5b21b6; font-size: 1.1em; }
.asm-resolved-date { margin: 4px 0 0; font-size: .85em; color: #7c3aed; }

.asm-toggle-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .85em; font-weight: 700;
    border-radius: 10px; padding: 8px 14px;
    border: 1px solid transparent; cursor: pointer;
    margin-bottom: 16px;
    transition: opacity .15s ease;
}
.asm-toggle-btn:disabled { opacity: .6; cursor: default; }
.asm-toggle-resolved { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.asm-toggle-resolved:hover:not(:disabled) { background: #ede9fe; }
.asm-toggle-reopen { background: #f9fafb; color: #374151; border-color: #e5e7eb; }
.asm-toggle-reopen:hover:not(:disabled) { background: #f3f4f6; }

/* ── Avisos de estado ── */
.asm-notice { padding: 12px 16px; border-radius: 10px; font-size: .88em; margin-bottom: 20px; }
.asm-notice-pending, .asm-notice- { background: #fff7ed; color: #92400e; border: 1px solid #fed7aa; }
.asm-notice-no_image { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.asm-notice-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Vacío ── */
.asm-empty { text-align: center; padding: 2.5em 1em; color: #6b7280; }
.asm-empty-icon { font-size: 2.5em; margin-bottom: 10px; }
.asm-empty p { margin: 4px 0; }
.asm-empty strong { color: #374151; }

/* ── Secciones ── */
.asm-section { margin-bottom: 24px; }
.asm-section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: .88em;
    margin-bottom: 14px;
}
.asm-section-high   { background: #ecfdf5; color: var(--asm-high); }
.asm-section-medium { background: #fffbeb; color: var(--asm-medium); }
.asm-section-count  { background: rgba(0,0,0,.08); border-radius: 99px; padding: 2px 8px; font-size: .9em; }

/* ── Colapsable (similitudes bajas) ── */
.asm-low-section { margin-top: 8px; }
.asm-low-section summary {
    cursor: pointer; color: var(--asm-low); font-size: .85em; font-weight: 600;
    padding: 6px 0; user-select: none;
}
.asm-low-section summary:hover { color: #374151; }
.asm-grid-low { margin-top: 12px; opacity: .85; }

/* ── Grid ── */
.asm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 18px;
}

/* ── Tarjeta ── */
.asm-card {
    position: relative;
    border-radius: var(--asm-radius);
    overflow: hidden;
    background: #fff;
    border: 2px solid #e5e7eb;
    transition: transform .35s cubic-bezier(.23,1,.32,1), box-shadow .35s, border-color .2s;
    opacity: 0;
    animation: asmIn .45s cubic-bezier(.23,1,.32,1) forwards;
}
.asm-card a { text-decoration: none; color: inherit; display: block; }
.asm-card:hover { transform: translateY(-6px); box-shadow: 0 16px 32px rgba(0,0,0,.1); }

.asm-dismiss-btn {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(17,24,39,.5); color: #fff; border: none;
    font-size: 13px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s ease;
}
.asm-dismiss-btn:hover { background: #dc2626; }
.asm-card.asm-dismissing { opacity: 0 !important; transform: scale(.92); pointer-events: none; transition: opacity .25s ease, transform .25s ease; }

.asm-card-match-high   { border-color: #bbf7d0; }
.asm-card-match-medium { border-color: #fde68a; }
.asm-card-match-high:hover   { border-color: var(--asm-high); }
.asm-card-match-medium:hover { border-color: var(--asm-medium); }

@keyframes asmIn {
    from { opacity:0; transform:translateY(20px) scale(.96); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

/* ── Barra de porcentaje ── */
.asm-pct-bar { position: relative; height: 6px; background: #f3f4f6; }
.asm-pct-fill {
    height: 100%; border-radius: 0 3px 3px 0;
    transition: width .6s ease;
}
.asm-card-match-high   .asm-pct-fill { background: var(--asm-high); }
.asm-card-match-medium .asm-pct-fill { background: var(--asm-medium); }
.asm-card-match-low    .asm-pct-fill { background: #9ca3af; }
.asm-pct-label {
    position: absolute; right: 6px; top: -18px;
    font-size: 10px; font-weight: 800; color: #6b7280;
}

/* ── Thumb ── */
.asm-thumb { position: relative; aspect-ratio: 1/1; background: #f9fafb; overflow: hidden; }
.asm-thumb img { width:100%; height:100%; object-fit:cover; transition: transform .5s ease; }
.asm-card:hover .asm-thumb img { transform: scale(1.08); }
.asm-no-thumb { display:flex; align-items:center; justify-content:center; height:100%; font-size:2em; color:#d1d5db; }
.asm-thumb-ai-badge {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,.55); color: #fff; font-size: 9px; font-weight: 700;
    padding: 3px 6px; border-radius: 6px; backdrop-filter: blur(4px);
}

/* ── Info ── */
.asm-info { padding: 13px 14px 14px; }
.asm-card-title { display:block; font-weight:800; font-size:.92em; color:#1f2937; margin-bottom:5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.asm-card-desc  { font-size:.77em; color:#6b7280; line-height:1.4; margin:0 0 8px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }

/* ── Highlights ── */
.asm-highlights { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:8px; }
.asm-hl-tag { font-size:.7em; background:#f3f4f6; color:#374151; padding:2px 7px; border-radius:6px; font-weight:600; }

/* ── Meta ── */
.asm-meta { display:flex; flex-direction:column; gap:3px; margin-bottom:9px; }
.asm-meta-item { font-size:.78em; color:#6b7280; }

/* ── Score pills ── */
.asm-score-breakdown { display:flex; flex-wrap:wrap; gap:4px; }
.asm-score-pill { font-size:.68em; padding:3px 7px; border-radius:6px; font-weight:700; }
.asm-pill-visual { background:#dbeafe; color:#1e40af; }  /* huella MobileNet */
.asm-pill-ai  { background:#ede9fe; color:#6d28d9; }      /* tags del análisis IA */
.asm-pill-tax { background:#fef3c7; color:#92400e; }
.asm-pill-loc { background:#dcfce7; color:#166534; }

/* ── Responsive ── */
@media (max-width:600px) {
    .asm-container { padding:1.4em; border-radius:16px; }
    .asm-grid { grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; }
    .asm-title { font-size:1.2em; }
}
