/* match-modal.css */
:root {
    --match-primary: #8b5cf6;
    --match-bg: rgba(15, 15, 15, 0.95);
    --match-border: rgba(255, 255, 255, 0.1);
    --match-input-bg: rgba(0, 0, 0, 0.4);
    --match-text-muted: #a1a1aa;
}

/* Overlay Global con efecto Glass */
.match-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.match-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contenido del Modal */
.match-modal-content {
    background: var(--match-bg);
    border: 1px solid var(--match-border);
    border-radius: 16px;
    width: 100%;
    max-width: 700px; /* Un poco más ancho para mejor lectura */
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow:
            0 25px 80px rgba(0, 0, 0, 0.9),
            0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.95) translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.match-modal-overlay.active .match-modal-content {
    transform: scale(1) translateY(0);
}

/* Header Estilizado */
.match-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--match-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(255,255,255,0.02), transparent);
}

.match-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    /* Efecto gradiente en el texto como en anilist-modal */
    background: linear-gradient(to right, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#match-provider-badge {
    opacity: 0.6;
    font-size: 0.8em;
    margin-left: 8px;
    font-weight: normal;
    -webkit-text-fill-color: #888; /* Resetear el gradiente para el badge */
}

.match-close-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--match-border);
    color: #ccc;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.match-close-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: rotate(90deg);
}

/* Buscador y Controles */
.match-search-container {
    padding: 1.5rem 2rem 1rem 2rem;
    display: flex;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
}

.match-input {
    flex: 1;
    background: var(--match-input-bg);
    border: 1px solid var(--match-border);
    color: white;
    padding: 1rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
}

.match-input:focus {
    background: rgba(0,0,0,0.6);
    border-color: var(--match-primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.match-search-btn {
    padding: 0 1.8rem;
    background: var(--match-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.match-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    filter: brightness(1.1);
}

/* Lista de Resultados */
.match-results-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 2rem 2rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.match-results-body::-webkit-scrollbar { width: 6px; }
.match-results-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.match-list-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

/* Tarjeta de Resultado Mejorada */
.match-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.match-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.match-poster {
    width: 50px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    background: #222;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.match-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    min-width: 0;
}

.match-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-item-meta {
    font-size: 0.85rem;
    color: var(--match-text-muted);
    font-weight: 500;
}

/* Botón de enlace externo refinado */
.match-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-left: 0.5rem;
}

.match-link-btn:hover {
    background: var(--match-primary);
    color: white;
    border-color: var(--match-primary);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* Mensajes y Spinner */
.match-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--match-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 3rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.match-msg {
    text-align: center;
    color: var(--match-text-muted);
    margin-top: 3rem;
    font-size: 0.95rem;
}
.match-msg.error { color: #ef4444; }

/* Responsive */
@media (max-width: 768px) {
    .match-modal-content {
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .match-search-container {
        flex-direction: column;
        gap: 0.8rem;
    }
    .match-search-btn {
        width: 100%;
        padding: 1rem;
    }
}